Include Java project as library

后端 未结 9 1892
眼角桃花
眼角桃花 2021-02-10 13:48

I have three projects in my eclipse workspace:

EventKitchenCore
EventKitchenDesktop
EventKitchenAndroid

EventKitchenCore contains

相关标签:
9条回答
  • 2021-02-10 14:34

    The simplest idea (which would work outside of Eclipse, too) would be to create a symlink/shortcut from your package-directory of the library into the src-folder of your projects:

    |- EventKitchenCore
       |- src/
          |- org.your.library.package <-+
    |- EventKitchenDesktop              |
       |- src/                          |
          |- org/desktop/something/     |
          |- symlink to ----------------+
    |- EventKitchenAndroid              |
       |- src/                          |
          |- org/android/something/     |
          |- symlink to ----------------+
    

    This way, you could compile the actual projects as if your library would be a part of the applications and you have your changes immediately reflected in both your projects.

    0 讨论(0)
  • 2021-02-10 14:34

    I believe what you are looking for is the "Link Source" option within Eclipse. From your android project, select the project and right-click to select "Build Path" > "Link Source". This will allow you to have your Java library accessible within the same build path as your android app for development.

    0 讨论(0)
  • 2021-02-10 14:38

    Here is a solution that may help you :

    1) Eclipse-Package Explorer - Your Project(Android) - Rightclick on your project.

    2) Click on Android (At left side of screen) - Now your screen may look like this -

    enter image description here

    Now at bottom of screen, in Library section you can add all the library project directly without making any JAR. Just you need to import those library projects in workspace or all your library project should be opened in eclipse.

    1) Click on Add button you will get the list of library projects available, choose from them and Build your project.

    Good Luck..

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