wood burning stoves 2.0*
The moose likes IDEs, Version Control and other tools and the fly likes package org.apache.log4j does not exist (Ant build compile) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "package org.apache.log4j does not exist (Ant build compile)" Watch "package org.apache.log4j does not exist (Ant build compile)" New topic
Author

package org.apache.log4j does not exist (Ant build compile)

Al Johnston
Ranch Hand

Joined: May 02, 2009
Posts: 99

Hi everyone,

I'm not positive if this should be in this forum or in the Ant forum...

Through the charities of JavaRanch members over on the Ant forum, I was able to get my build file to work properly. However, when I incorporate log4j classes in the build, I get the error "package org.apache.log4j does not exist". I added the log4j jar to my environment variables appended to "CLASSPATH". I also have the log4j jar file deployed on my web-inf target.

Eclipse has no problem finding the log4j.jar. But, I can't seem to help Ant find it when I run my build.xml file in Eclipse. I appreciate the help.

The compiler error is:



The build file location is:



The error occurs at line 101 unless I remove all references to log4j. If I do that, I get no compiler complaints.

Best,
Al
Al Johnston
Ranch Hand

Joined: May 02, 2009
Posts: 99

Also, since I'm new to log4j (and ant for that matter), I made sure to follow the instructions for setting up the log4j classpath. I ran the log4j Hell.java example from a command prompt and got the expected Logger output.

Al Johnston
Ranch Hand

Joined: May 02, 2009
Posts: 99

I figured it out (finally). In my build.xml file, I have a few classpaths set. Like so:


Later, when I do my class compile, I call these class paths...



Despite having an environmental variable set up and having log4j.jar in the web-inf and common/lib directories of Tomcat, the only way the compile works is when I put log4j.jar in classpath.build directory.

Thanks!

Al
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: package org.apache.log4j does not exist (Ant build compile)