Need help with using org.apache.log4j pakages (LogManager)

S

spiderboy

Greetings,

I downloaded logging-log4j-1.2.14 package and edited the classpath
variable to point to this directory:

C:\logging-log4j-1.2.14\dist\lib\log4j-1.2.14.jar

And my java code has this line:

private static final Logger myLogger =
LogManager.getLogger(<my_class_name>.class.getName());

I am able to compile the code just fine, but when I try to run it, it
gives me this following error:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/
log4j/LogManager at <my_class_name>.<clinit>(line number ...)

I looked at the build.xml file but not sure what needs to be modified.
Can anyone please give me some help on how to resolve this error. I
have researched this problem rather thoroughly but failed a find any
solution.

Thanks much.
 
R

Richard Reynolds

spiderboy said:
Greetings,

I downloaded logging-log4j-1.2.14 package and edited the classpath
variable to point to this directory:

C:\logging-log4j-1.2.14\dist\lib\log4j-1.2.14.jar

And my java code has this line:

private static final Logger myLogger =
LogManager.getLogger(<my_class_name>.class.getName());

I am able to compile the code just fine, but when I try to run it, it
gives me this following error:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/
log4j/LogManager at <my_class_name>.<clinit>(line number ...)

I looked at the build.xml file but not sure what needs to be modified.
Can anyone please give me some help on how to resolve this error. I
have researched this problem rather thoroughly but failed a find any
solution.

Thanks much.
what is your classpath set to when you run it? (not when you compile it)
 
L

Lew

spiderboy said:
Greetings,

I downloaded logging-log4j-1.2.14 package and edited the classpath
variable to point to this directory:

C:\logging-log4j-1.2.14\dist\lib\log4j-1.2.14.jar

And my java code has this line:

private static final Logger myLogger =
LogManager.getLogger(<my_class_name>.class.getName());

I am able to compile the code just fine, but when I try to run it, it
gives me this following error:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/
log4j/LogManager at <my_class_name>.<clinit>(line number ...)

I looked at the build.xml file but not sure what needs to be modified.
Can anyone please give me some help on how to resolve this error. I
have researched this problem rather thoroughly but failed a find any
solution.

Can you provide an SSCCE?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top