Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to rename a class and its corresponding file in Eclipse?

Tags:

java

eclipse

Cannot find any menu item to do this. Is it doable?

like image 662
user496949 Avatar asked Mar 03 '11 08:03

user496949


People also ask

How do I change my class name in an IDE?

Right-click the mouse on the class name and choose the following option from the context menu option: Refactor >> Rename… This will open a new window called Rename Compilation Unit. Alternatively, we can press the keyboard shortcut Alt + Shift + R.

Can we edit class file in Eclipse?

Class files are compiled entities. You can't just edit them. You need to get the actual source used to compile the class files.


2 Answers

Just right click on the class in the project explorer and select "Refactor" -> "Rename". That it is is under the "Refactor" submenu.

like image 137
Tom Quarendon Avatar answered Sep 21 '22 04:09

Tom Quarendon


Shift + Alt + r (Right click file -> Refactor -> Rename) when cursor is on class name. The file and constructors will be also changed.

like image 43
Damian Leszczyński - Vash Avatar answered Sep 18 '22 04:09

Damian Leszczyński - Vash