简体   繁体   中英

Changing the package name in all the java files to the existing package in eclipse

I have created some package. I had java files from previously created package. Now, I want to change the name of package inside all java files to the package i just created in eclipse. How to do that?

图片

右键单击包资源管理器中的包名称,然后--->重构---->重命名

  1. Locate the two folders where the projects are contained
  2. Move the .java files inside the /src/ your package name folder of your old project to the /src/ your new package name folder in your new project
  3. Fix the errors popping out by eclipse: Change the old package name in your .java files to the new package name.

Java透视图中,在“ 程序包资源管理器”或“ 项目资源管理器”中选择程序包,然后使用菜单栏或上下文菜单进行“ 重构” ->“ 重命名” ,或按快捷键:

Alt+Shift+R

右键单击您的包,然后选择“重构”并选择“重命名”。

Select package and press F2 . In new wizard enter new package name and click on OK .

Select the package and press Alt+Shift+R gives you option for rename and rename it. it will change in all the java files.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM