I have an executable jar (Main-Class specified in the manifest file), which has some runtime dependecies on a group of other jars.
When running:
java -cp lib/dependentJar1.jar;lib/dependentJar2.jar -jar myJar.jar
I always get a NoClassDefFoundError for a class in the dependent jars.
If instead I try:
java -cp lib/dependentJar1.jar;lib/dependentJar2.jar;myJar.jar MyMainClass
it works!!
I also have been able to specify the class path within my executable jar's manifest file, which also works.
Is there a reason why specifying the class path with the -jar option does not work, or am I doing something wrong??