my dog learned polymorphism
The moose likes Tomcat and the fly likes Classpath question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Classpath question" Watch "Classpath question" New topic

Classpath question

Andy Hahn
Ranch Hand

Joined: Aug 31, 2004
Posts: 225
Hi, I am having trouble setting up my classpath on Tomcat. I am receiving errors for log4j and hibernate.cfg.xml. Apparently they are not being found in the classpath.
I have a few questions:

1. Do I have to use the common/lib directory or can I use webapps/<mywebApp>/lib? I would prefer the latter since there are several other projects under Tomcat.

2. Is there java code I could use for debugging? In the past I have tried <%=System.getProperty("java.class.path") %>.

3. I am adding all of my jars and property files in webapps/<mywebApp>/lib. Will these get picked up and added to the classpath on startup?

Ben Souther

Joined: Dec 11, 2004
Posts: 13410

Tomcat only looks for Jar files under WEB-INF/lib.

Put your file (and any other file that needs to be on the classpath) in WEB-INF/classes

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
I agree. Here's the link:
subject: Classpath question
It's not a secret anymore!