1

This is not another noob question about referencing.

I have a framework that when compiled...generate a JAR file...As of now I just reference as an external JAR. The problem is, I need to edit the framework and I don't want to constantly export framework project and recompile my main project.

I need to to be where I compile the main project and it compiles the referenced JAR file from the framework project.

How to reference a different Java project in Eclipse Doesnt work...this is not a web project.

I also tried: Adding a reference between Eclipse Java projects Doesnt work.

How is this really done?

Community
  • 1
  • 1
FrostyFire
  • 3,212
  • 3
  • 29
  • 53

2 Answers2

2

I recently had a similar problem when importing the source code files into a new Java project. Here are the steps to fix that:

Project => Properties => Java Build Path => Source and add the root directory.

enter image description here

Then I had to rename the org folder to src. I then had to rename each of the package libraries to append org. to the beginning of the package name, like so:

enter image description here

Project => Properties => Java Compiler => Compiler Compilance Level make sure that's set to the correct version (I used 1.5 but it depends on what features you need).

enter image description here

And finally, make sure you are exporting the dependencies on the library correctly: ( Project => Properties => Java Build Path => Order and Export and check the checkboxes for your dependencies)

enter image description here

CC Inc
  • 5,842
  • 3
  • 33
  • 64
1

Your first link (How to reference a different Java project in Eclipse) should just work, if you follow these steps:

  • Make sure your framework project is correctly identified as a Java project by Eclipse (it shows a little J in the folder icon, you can also find the Java nature in its .project file)
  • Make sure your framework project compiles (Eclipse finds no problems about it and generates a valid ./bin folder or whatever you call it with .class files in it)
  • Make sure your other project is identified by Eclipse as a valid Java project too
  • Unreference any instance of the compiled framework .jar in your other project (this should make some compilation failures appear in it - the framework classes are gone!)
  • Right-click your other project properties, go to Java Build Path, projects tab, add your framework project to it (with this, the compilation problems should have disappeared from your other project)

Please comment if you still find problems after these steps

Community
  • 1
  • 1
Jorge_B
  • 9,712
  • 2
  • 17
  • 22