开发者

classpath problem in Batch file

Below is the snippet of Batch file

set CLASSPATH=%    CLASSPATH%;D:\BatchApps\RDev\RTesting\GRTesting_Config.properties.;D:\BatchApps\RDev\RTesting\log4j.properties

c:\progra~1\java\jre6\bin\java -Xms512M -Xmx512M -jar  D:\BatchApps\RDev\GRTesting\GRTesting.jar

GRTesting.jar is executable jar. So, when I run this batch file, I am getting properti开发者_如何学运维es file not found exception that is java.util.ResourceBundle.throwMissingResourceException

Anybody has an Idea?


First off you should not use the CLASSPATH environment variable, it causes too much trouble. Use the -cp parameter for java.exe instead.

Having said that: when using -jar any classpath defined through -cp or CLASSPATH is ignored.

You need to start your application using

SET CP = ....
SET CP=%cp%;D:\BatchApps\RDev\GRTesting\GRTesting.jar

java -Xms512M -Xmx512M -cp %CP% your.MainClass

Edit: I don't think you can add .properties files like that directly. I think you need to add the directory containing the property files, not the files themselves:

SET cp=D:\BatchApps\RDev\GRTesting\GRTesting.jar;D:\BatchApps\RDev\RTesting
java -Xms512M -Xmx512M -cp %CP% your.MainClass
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜