| Author |
Question about creating a jar file with eclipse
|
joe black
Ranch Hand
Joined: Dec 03, 2003
Posts: 103
|
|
I am trying to design a layered application, and I am creating a workspace for each layer. I first started with the persistence layer. It uses hibernate, and now I want to create a jar file so that the other layers can use it as a dependency. I placed all the hibernate jars in src/lib, and all source files are under src/java. However, after creating a jar using export->jar file, and adding it to the other project's build path, it cannot find any of the hibernate stuff. I assume I am not understanding how to use the java build path correctly.
|
 |
Christophe Verré
Sheriff
Joined: Nov 24, 2005
Posts: 14672
|
|
Did you add the JARs into your project properties ? RightClick your project -> Properties -> Java Build Path -> Libraries
|
[My Blog]
All roads lead to JavaRanch
|
 |
joe black
Ranch Hand
Joined: Dec 03, 2003
Posts: 103
|
|
|
I added the hibernate jars to the project properties of the persistence layer. Do I need to add the hibernate jars to the other projects as well?
|
 |
Paul Clapham
Bartender
Joined: Oct 14, 2005
Posts: 16483
|
|
|
Of course. How should Eclipse know that you intended for there to be a relationship between the two projects?
|
 |
Christophe Verré
Sheriff
Joined: Nov 24, 2005
Posts: 14672
|
|
|
Yes, you need to add the reference to external jars wherever you use them.
|
 |
Ilja Preuss
author
Sheriff
Joined: Jul 11, 2001
Posts: 14112
|
|
I wouldn't use the jar for the other projects, but let them depend directly on the persistence project. The persistence project can then export the dependencies on hibernate et al. This way it's easier to test how the projects work together and it enables easy cross-project refactorings, while still making sure that you don't get any undesired code dependencies. You can still use the different jar files for distribution.
|
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
|
 |
 |
|
|
subject: Question about creating a jar file with eclipse
|
|
|