my dog learned polymorphism*
The moose likes Ant, Maven and Other Build Tools and the fly likes Any ideas why my class isn't getting found? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Any ideas why my class isn Watch "Any ideas why my class isn New topic

Any ideas why my class isn't getting found?

Dave Alvarado
Ranch Hand

Joined: Jul 02, 2008
Posts: 436

I wrote a custom task for Ant (using Ant 1.7, Java 1.6). The custom task references the log4j framework, and even though I include it in my classpath, I'm getting a "class cannot be found" error. Here is the relevant part of my Ant task ...

and here is the output I'm getting ...

Notice that log4j is included. I have verified the path exists. Any ideas what else I should check for? - Dave
Greg Charles

Joined: Oct 01, 2001
Posts: 2774

Hmm, that's a puzzle. Still, it must be something. You're picking up log4j from Tomcat, right? (/Library/Tomcat/Home/common/log4j-1.2.4.jar) I'd suggest to keep picking at the obvious things. Is the jar really there with exactly the same name? (I know you verified it already, and Ant must be picking it up somehow. Still a quick "file /Library/Tomcat/Home/common/log4j-1.2.4.jar" would double-check) Is the file readable by whatever user is running Ant? If you look in the jar, is the Logger class there and in the right package?

I agree. Here's the link:
subject: Any ideas why my class isn't getting found?
Similar Threads
Problem running Spring Application
Configurin Spring AOP with Spring 3.0.0
Ant classpath issues
Hibernate Validation not working.. default provider not available
Ant taskdef & classpath