Re: Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/Priority
Flo 'Irian' Schaetz wrote:
I'm no expert, but when I use Ant to build my files and create a .jar
(and .zip it toegether with the libs), I always add the class-path to
the manifest-file, for example:
Class-Path: . ./libs/MyLib.jar
With Ant it's rather simple to do that...
<manifest file="manifest.txt">
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Main-Class" value="translator.Translator"/>
<attribute name="Class-Path" value=". ./libs/MyLib.jar"/>
</manifest>
Then I can use...
<jar destfile="${ant.project.name}.jar" basedir="${bin}"
manifest="manifest.txt"/>
...to create the jar with the correct manifest...
dushkin wrote:
Well, I added
Class-Path: ..\libs\lib\log4j-1.2.14.jar
to the manifest file but the same result occur.
Any other ideas?
Notice that Flo's example used forward slashes, not backslashes as yours did.
Also, you are rooting the log4j JAR's location in the parent directory of
your JAR, not usually safe, unlike Flo's example which used the current directory.
Notice that the log4j JAR must be located in a directory on the network / file
system where your JAR is, because:
The Class-Path header points to classes or JAR files on the local network, not JAR files within the JAR file or classes accessible over internet protocols.
From
<http://java.sun.com/docs/books/tutorial/deployment/jar/downman.html>
which you should read.
--
Lew