Eclipse - Importing your own library

后端 未结 2 1681
死守一世寂寞
死守一世寂寞 2021-01-03 02:47

Okay, hopefully this is quick and easy.

I have two separate java projects, \'Library\' and \'Project\', and I have a class in \'Project\' that wants to implement a m

相关标签:
2条回答
  • 2021-01-03 02:57

    Just have "Project" reference your "Library", on windows the process is (using menu / tab names)

    • 1. Go to: Project -> Properties -> Java Build Path -> Projects
    • 2. Client Add...
    • 3. Select your "Library" project from the list
    • 4. Click Ok
    • 5. Click the other Ok

    Now your done and you can use import for classes in your "Library"

    0 讨论(0)
  • 2021-01-03 03:13

    There are several ways:

    A. Import source files

    • Right click your project in the project explorer
    • select Properties-->Java Build Path
    • Click on the Source tab and the Link Source button and add the root folder containing Library and click Finish
    • Now click on the Projects tab and click the Add button to add your 'Library'. Click Ok and you're done

    B. Import Jar When you compile your eclipse project it creates a jar for your project in the 'Build' subfolder of the root directory of your project. To import that in you current project:

    • Again Right click your project in the project explorer
    • Select Properties-->Java build Path
    • Click on the Libraries tab and click Add External JARs. Navigate to the folder containing Library.jar and click Finish and click Ok

    You should now be able to import your names from your Library Project

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