Class-path in manifest not read when running jar in Unix
I have a client application that needs to run on Unix. It works fine in Windows but i get a NoClassDefFound exception in unix. Here's my manifest file:
Manifest-Version: 1.0 Ant-Version:开发者_运维百科 Apache Ant 1.6.5 Created-By: 2.3 (IBM Corporation) Main-Class: com.main.Client Class-Path: lib/commons-lang-2.3.jar lib/commons-io-1.3.2.jar lib/comm ons-logging-api-1.1.jar lib/log4j-1.2.12.jar
And the Client.jar structure:
com com/main lib meta-inf
To run it, i use the command below:
$JAVA_HOME/jre/bin/java -jar Client.jar
It works fine in windows. Somehow i think that its not reading the manifest right. Help please! Thanks!
Maybe because your meta-inf folder is in lower-case?
One way is to make sure you have defined your CLASSPATH variable for the user that is running the program.
$ echo $CLASSPATH
if there is nothing shown from the above, then export it
$ export CLASSPATH="/lib/commons-lang-2.3.jar:/your/other/paths"
精彩评论