How to rename a class in Eclipse IDE?



In this post, we will learn how to rename a class in Eclipse IDE. This is useful when you want to refactor a class name in a Java Project.

Steps to Rename a Class

Launch Eclipse IDE.

Select the class that needs to be renamed in the Project Explorer.



Right Click >> Refactor >> Rename.


Rename a class in Eclipse

Rename the class and click on the Next> button.

Execute caution while you rename a class which has a main method.

Eclipse would show a preview of the refactored class name and the old code.

Click Finish on the Rename compilation unit screen. Eclipse would rename the class name with the updated name.