Is it possible to create a JAR file that requires external dependencies without including those dependencies in the JAR file?
My google-fu has failed to give me an answer; everything that I have found shows how to include them in the JAR file, but not what to put in the manifest file to say "I haven't got them, look in the user's classpath". I would assume that the dependencies are properly installed and configured on the user's classpath.
In my case, my dependencies are Apache Commons CLI and Math.
Edit: Inside my JAR file, I have Main.class.
My manifest file looks like:
Manifest-Version: 1.0
Created-By: 1.6.0 (Sun Microsystems Inc.)
Main-Class: Main
My CLASSPATH looks like
.;C:\Program Files\Java\jre1.6.0_06\lib\ext\QTJava.zip;C:\java_lib\commons-cli-1.2.jar;C:\java_lib\commons-math-2.0\commons-math-2.0.jar
If I include the dependencies in the JAR in /lib
and add the line Class-Path: lib/commons-math-2.0.jar lib/commons-cli-1.2.jar
to the manifest, then it does work.
I've tried adding Class-Path: commons-math-2.0.jar commons-cli-1.2.jar
to the manifest without including the files in the JAR just to see if that would work, but it didn't.