开发者

Can't add classpath through command line

开发者 https://www.devze.com 2022-12-29 23:00 出处:网络
I want to add the classpath through a command line call. The call looks like this: java -cp ..\\conf -jar ..\\lib\\switcher.jar

I want to add the classpath through a command line call. The call looks like this:

java -cp ..\conf -jar ..\lib\switcher.jar

In the conf directory is an XML file that defines the application context and the log4j.properties file. But when I run this command, Java obviously can't find those two files, although I've开发者_StackOverflow added them to the class path.

I also tried specifying the absolute path of the conf directory, but it didn't work either.

Any hints?


If you use the -jar option, java.exe ignores the classpath. It will only look in that jar. Try using the manifest Class-Path instead to get Java to look in auxiliary jars.


I guess your XML file may contain the used ClassPath ...

Unfortunatly, the java command doesn't understand any subtle way to express your class path. You HAVE to give it a list of directories/jar/zip. Any other way of setting the classpath will result in no action.

0

精彩评论

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