Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Al Johnston
Ranch Hand
Posts: 99
Flex Java Postgres Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 99
Flex Java Postgres Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 99
Flex Java Postgres Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic