Is there a way to run a JSP that will give me the current classpath used by Tomcat?

Dan Waldner

Okay, here is how Tomcat obtains the classpath for given application "APP".

1st layer: The CLASSPATH variable you set in the Environment Variables. All the jars included in there IN ORDER. If there are duplicate libraries, the one encountered first will be the active library. Others won't be included.

2nd layer: The %TOMCAT_HOME%lib directory. This includes all the jars located in there which are common to all your web applications.

3rd layer: The %TOMCAT_HOME%webappsAPPWEB-INFlib & %TOMCAT_HOME%webappsAPPWEB-INFclasses directories. These are app specific.

If you're running into problems with your classpath, chances are one of the following will fix it:

A) You did list the proper directories, however you didn't include the jar file at the end of your classpath. (ie. C:javalib rather than C:javalibfoo.jar). If you explicitly include the jar file in your CLASSPATH variable, it will load it up properly.

B) The classpath doesn't even include the right path, however, you sound like you've checked this and still it doesn't work, so chances are A) will work for you.

As for the question you asked originally, I do not know a way of finding out the class path via JSP code, but by using the three elements listed here, you can construct the classpath for debugging purposes.

Hope this helps,


PS. When you execute SHUTDOWN.BAT, it will usually spit out all the libraries to the screen that TOMCAT is currently using. By outputting that to a file, you can also see what's on Tomcat's mind.

0 Comments  (click to add your comment)
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



About | Sitemap | Contact
By using this site, you agree to the Privacy Policy