include external jar when running java -jar

Is there a reason why you are avoiding invoking the main class like

java -cp /usr/local/jar/foobar.jar:/some/other/path.jar com.your.main.classname

?

This type of invocation allows you to mix absolute paths with relative paths. Put this into a shell script or batch file to avoid having to actually type or remember the full classpath to simplify things.

Leave a Comment