4

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 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?

2 Answers 2

9

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.

Sign up to request clarification or add additional context in comments.

2 Comments

0

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.

1 Comment

the problem is the -jar option! When used the only source for user classes is the jar-file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.