Friday, June 1, 2012

Executable JAR Classpath Gotcha

When you use "java -jar" to run an executable JAR file, the CLASSPATH environment variable and the "-cp" parameter doesn't take effect. Instead, you have to put the classpath inside the manifest file, such that the manifest file has the following lines:

Main-Class: com.xxx.xxx.Main
Class-Path: abc.jar xyz.jar

No comments:

Post a Comment