How to use classpath with java -jar
807599Jan 25 2007 — edited Jan 25 2007I have an application which is self contained in a jar files. I can start it
as follow:
java -jar application.jar
In this jar file, I have included some third party jar files that are used by my
application. When I remove one of the jar files and try to use classpath,
it does not work:
java -classpath /jardirs/Tool.jar -jar application.jar
It appears as the class path is totally ignored.
Of course, I can define Class-Path manifest in the jar file to refer to
the location of myTool.jar. However, The location could be different based on
which computer the application is run.
I am wondering if there is a solution where I can specify the location of
Tool.jar separately from application.jar, as an option in "java -jar application.jar".
Your help is greatly appreciated.