Hi,
I'm trying to create a jar so the end user can simply start the
application like this:
java -jar somejar.jar
This is all fine except how can I embed libraries (in jars) in this jar
file and have them appear in the classpath? Or do I need to unjar those
libraries individually and jar them into the new archive?
My brain must be f*cked up after creating .war's and .ear's for too
long ;)
Cheers,
Bas.
Rogan Dawes - 04 May 2006 16:42 GMT
> Hi,
>
[quoted text clipped - 13 lines]
>
> Bas.
Couple of options
put your library jars in the classpath in the manifest, and place the
jars themselves in a directory relative to your application jar. NOT in
the jar itself!
Alternatively, look for One-Jar or UberJar which can do what you are
looking for.
A third possibility is to use something like Proguard which will package
up all of your required classes into a single monolithic jar (but it
breaks if the jars need to be signed, etc)
Rogan
Roedy Green - 04 May 2006 20:23 GMT
>This is all fine except how can I embed libraries (in jars) in this jar
>file and have them appear in the classpath?
Read up on the manifest. You can list aux jars in there with relative
urls.
See http://mindprod.com/jgloss/jar.html
http://mindprod.com/jgloss/jar.exe.html

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.