Reputation: 105067
I've developed a library L
that made use of some dependency .jar files D
. I've then decided to export it as a Jar J
, using Eclipse.
When trying to make use of J
, I get java.lang.NoClassDefFound / java.lang.ClassNotFound errors.
What's the easiest way to have my library L
deployed? I'd prefer to have it packed together with its dependencies, but it's acceptable to have them phisically separated from L
.
I've looked up inside the L.jar
and the dependencies are definitely there, so it seems like a matter of having a file telling java where to look them up for.
Thanks
Upvotes: 0
Views: 197
Reputation: 46
I am using Eclipse Juno Release(4.2), it's very handy to do this.
run command java -jar myapp.jar
Upvotes: 0
Reputation: 42451
If you want to create and pack the jar along with dependencies you can consider to use some programming for that. Take a look on JBoss ShrinkWrap
Hope this helps
Upvotes: 0
Reputation: 115328
User maven or gradle. These 2 build tools do exactly what you need.
Upvotes: 1