calling a class in another project Eclipse

前端 未结 7 900
执笔经年
执笔经年 2020-12-03 14:16

I have a project \"A\" and I need to call a class \"c\" from another project \"B\".

I have done the following. Click in \"A\" -->Properties -->Build Path --> and in

相关标签:
7条回答
  • 2020-12-03 14:56

    If B is in the same workspace and alos open you have to put int in "Projects" not is "Source". If you want to make A "more" independent, you have to export B.jar and the add it to "Libraries"

    0 讨论(0)
  • 2020-12-03 15:00

    Put the Project B on the Build path, then do a Clean project from Project Menu option... and then use it..

    -

    Click in "A" -->Properties -->Build Path --> Projects ---> Add the Project --->Ok
    
    0 讨论(0)
  • 2020-12-03 15:08

    Also consider to use maven. Its very useful if you are having multi-module projects. Just add the dependencies of abother project and maven will take care of rest..!

    0 讨论(0)
  • 2020-12-03 15:10

    You should add another project in "Project" tab, or add class folder of the project in "Libraries" tab.

    example

    0 讨论(0)
  • 2020-12-03 15:14

    You need to add project B to the Run configuration used by project A. In the menu Run -> Run configurations... , add the project B in the tab 'classpath' of your run configuration.

    0 讨论(0)
  • 2020-12-03 15:14

    create project "A" as jar and add this jar in your project "B" build path.then you can call which class you want and import that class package name with calss name.

    0 讨论(0)
提交回复
热议问题