Meaningless Drivel is fun!
The moose likes JSP and the fly likes rules for location of Java .class files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "rules for location of Java .class files" Watch "rules for location of Java .class files" New topic

rules for location of Java .class files

Robin Clark
Ranch Hand

Joined: Dec 17, 2003
Posts: 81
I have two different web applications that have different JSPs. However, they both use a common set of java classes that are in a package called vss.
I am having trouble trying to get the JSP to find the vss package unless it is installed under my web application in WEB-INF/classes.
I would like to install the package in a directory that is entirely separate from the Tomcat installation. I did this and then placed the full path name for the vss.jar in my classpath environment variable. I re-started Tomcat.
The application is a bit complicated because it is VXML instead of HTML, in other words it is a voice application, not a web browser application. In any case, suffice it to say that it didn't work with my new configuration. Can someone tell me if there are rules against executing Java classes that are not in the WEB-INF directory structure? Or did I just do something wrong? It is entirely possible because there are so many weird bits and pieces to this application.
For now, I am maintaining two copies of the source code and the compiled classes -- one under each web application's WEB-INF directory.
Thank you!
brad balmer
Ranch Hand

Joined: Mar 08, 2004
Posts: 57
You could just maintain one location for the source and then instead of deploying the .class files in a directory, jar them up and place them in the WEB-INF/lib directory.
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63837

Most servlet containers will take no heed of the system classpath. To share a library of classes across multiple web applications, each container will provide a common area. In Tomcat, for example, you would jar up your classes and place the jar file in $CATALINA_HOME/shared/lib.

[Asking smart questions] [About Bear] [Books by Bear]
Robin Clark
Ranch Hand

Joined: Dec 17, 2003
Posts: 81
Thank you. I think that I will keep the source code under one app and place the vss.jar in my Tomcat common/lib directory.
I forgot that Tomcat ignores the system classpath. As usual I am trying to do too many things at one time so it is hard to see which one of them is causing me problems.
I agree. Here's the link:
subject: rules for location of Java .class files
It's not a secret anymore!