Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j
807601May 29 2008 — edited Jun 2 2008Hello
I have a problem when I try to execute a jar file, I got this message:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/Logger
at com.iusacell.inactivar.main.Inactivar.<clinit>(Inactivar.java:14)
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Logger
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
I wrote on command line:
java -classpath "C:\Act_Taras_log\lib\log4j-1.2.15.jar;C:\Act_Tareas_log\lib\classes12.jar" -jar C:\Act_Tareas_log\lib\UpdateInstTask.jar
I generate this jar with: IBM Rational Software Development Platform Versi?n: 6.0.0, I don't know if this can make a difference instead to create jar file on command line.
I wrote within MANIFEST file Main-Class, but I didnt include classpath; for that reason I included classpath on command line, but it didn't work.
I tried too including classpath within MANIFEST file, like this: Class-Path: /lib/log4j-1.2.15.jar When I include classpath in MANIFEST a warning appear
something like that:
"/lib/log4j-1.2.15.jar, can't not be resolve" but I can run my application, but when jar file is generated, and execute it, shows that exception.
Can some body tell me, Why is that?
Thanks in advance.