I've got a project that I jar into an executable jar with ant. I then zip up the executable jar along with the dependent jars it needs as well as a couple text files it reads. I've got the dependent jars listed in the class-path of the manifest file, the program can read the text files, all that appears to be working. It is structured in the zip file so that the executable jar, the dependent jars, and the text files are all in the same directory, like so:
/unzippedDir myExecutable.jar file1.txt file2.txt log4j.xml commons-httpclient-3.1.jar log4j-1.2.15.jar other jars, etc.
Now I'm trying to enable logging because the user is having issues that I can't reproduce, so I'd like to be able to create logs that he can send me.
The logging works fine when run from Eclipse (it's a swing app). But there's no logging when run from the executable jar. I've put log4j.xml into the same directory as everything else listed above, and added log4j.xml to the class-path of the manifest file.
The classpath is supposed to be a list of directories and jar files. You can't put individual files into the classpath. That's why your log4j.xml file isn't in the classpath, the way you have things set up. Try putting the directory "." into the classpath.
Joined: Jul 30, 2004
Wohoo, that did it! (putting directory "." in the classpath)
Thanks Paul! Thanks also to Martijn for his quick responses.
subject: why is log4j not working in executable jar?