Using a project's package in another project in eclipse

老子叫甜甜 提交于 2019-12-11 03:55:19

问题


how can I use the classes of a package out of the main project where it has been defined? for example imagine there is an Employee class in package people which belongs to ProjectOne. let's assume Employee is needed in another project (ProjectTwo) with the same features.What should I do there?


回答1:


Right-click on ProjectTwo in the Package Explorer. Go to Build Path -> Configure Build Path. Go to the Projects tab, click Add, select ProjectOne, and click OK, then click OK again to exit the project properties window.

Then import your classes as usual - within ProjectTwo, you should be able to see ProjectOne's classes as if they were in the same project.




回答2:


Since i dont know wich eclipse your using i tryed this on eclipse kelpler

you can Drag packages into the other Projects src folder to use them



来源:https://stackoverflow.com/questions/28472104/using-a-projects-package-in-another-project-in-eclipse

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!