So for context, I was playing with JOGL (JSR-231) and found myself having to append the jogl.jar and gluegen-rt.jar to the classpath to compile and run my toy app. I finally decided to do it the right way and throw everything into a single Jar file for simplicity and ease of distribution. Thankfully the jar archiver tool rocks and made this a lot simpler than the other solutions I read online about using OneJar.
My Manifest.txt file looks like this:
Manifest-Version: 1.0My file layout looks like this:
Main-Class: App
Class-Path: extralibs/gluegen-rt.jar extralibs/jogl.jar
/src/And finally the jar line that create the jar file from my app sources and the extra jogl jars:
- App.java
- mylibs/
- MyClasses.java
- extralibs/
- jogl.jar
- gluegen-rt.jar
- Manifest.txt
jar cfm Exec.jar extralibs/Manifest.txt App.class mylibs/*.class extralibs/*.jarSo now by running that, I get a single JAR archive that contains my application and the dependant jars with their correct classpaths :)
Regards