简体   繁体   English

将所有Java文件中的软件包名称更改为Eclipse中的现有软件包

[英]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. 我有以前创建的包中的Java文件。 Now, I want to change the name of package inside all java files to the package i just created in eclipse. 现在,我想将所有java文件中的包名称更改为我刚刚在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 移动.java文件旧项目的/ src目录/ 你的新包名文件夹/ src目录/ 你的包名的文件夹内的新项目
  3. Fix the errors popping out by eclipse: Change the old package name in your .java files to the new package name. 修正因eclipse弹出的错误:将.java文件中的旧软件包名称更改为新软件包名称。

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

Alt+Shift+R

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

Select package and press F2 . 选择程序包,然后按F2 In new wizard enter new package name and click on OK . 在新向导中,输入新的程序包名称,然后单击“ OK

Select the package and press Alt+Shift+R gives you option for rename and rename it. 选择程序包,然后按Alt + Shift + R会提供重命名和重命名的选项。 it will change in all the java files. 它将在所有Java文件中更改。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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