say I am doing this:
java -jar someJar
"someJar" needs to reference tools.jar (for jsp compilation). I don't want to bundle tools.jar inside of someJar because I am afraid of a incompatibility with the executing JVM. I can't specify -classpath because it is ignored when -jar is used. I tried -Djava.ext.dirs and that did not work. Does anyone have an idea on how I can reference tools.jar from an executable jar?
Starting with Java 1.4, tools.jar needs to be included in the user classpath:
The tools classes are now in a separate archive (tools.jar) and can only be used if included in the user class path (to be explained shortly).
In other words, tools.jar cannot be placed in an extensions directory. This effectively means that specifying it in the manifest of the JAR might not be a good idea at all. There are a couple of options however:
java -cp $JDK_HOME/lib/tools.jar MainClass command, where MainClass is the fully qualified name of the class.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With