views:

55

answers:

2

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

java -cp ..\conf -jar ..\lib\zpv-ekvkumsetzer-0.0.1-SNAPSHOT.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?

A: 

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.

Riduidel
the problem is the `-jar` option! When used the *only* source for user classes is the jar-file.
Carlos Heuberger
+2  A: 

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.

stacker
Thank you. See also here: http://java.sun.com/j2se/1.4.2/docs/tooldocs/linux/java.html
Bernhard V
@stacker: almost my answer, just missing a link: http://java.sun.com/docs/books/tutorial/deployment/jar/downman.html
Carlos Heuberger