简体   繁体   中英

How to add project of different workspace into the current workspace in Eclipse

I have two workspaces and I want to use java file as a parent class or you can say extends it from workspace2 to workspace 1 in eclipse, how can I do this? As I can add project from same workspace but unable to figure out from different workspace. I dont want to import the project.

Thanks in advance

您可以在类所在的系统中使“新建文件”->“高级”选项和“链接到文件夹”

您需要将项目从工作区2导入到工作区1。您可以在项目的构建路径配置中的另一个工作区中引用您的项目,从而链接两个Eclipse项目,即使它们位于不同的工作区中也是如此。

Way 1

You can add the second project's src folder to the current project and you can add them in your project.

Right click on project -> Build path - > source tab - > link source 

在此处输入图片说明

Way 2 :

Make that external project as a jar and add as a dependency.

If you want the code to be available for changes this are your options:

You have to either import the project or create a new workspace that includes them all.

Note that you may extend the java class from the same project or from another project within the workspace, but not from another workspace.

If you are willing not to have the code in front of you available for changes, you may build the first workspace' project into a jar and then use that as part of your other workspace.

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