On 8/4/06, Gary Benson <gbenson(a)redhat.com> wrote:
Ryan Ollerenshaw wrote:
> I am trying to set up Tomcat 5 on Fedora Core 5 and everything iw
> working find but i do not know how to set my classpath when using
> tomcat below is a few things that i have tried.
>
> I have found i can use the following code to print out the classpath
> that my program is actaully using, the code is:
>
> Get the System Classloader
> ClassLoader sysClassLoader = ClassLoader.getSystemClassLoader();
>
> //Get the URLs
> URL[] urls = ((URLClassLoader)sysClassLoader).getURLs();
>
> for(int i=0; i< urls.length; i++)
> {
> out.println(urls[i].getFile());
> out.println("<br>");
> }
>
> and the classpath that is printed is:
>
> /usr/java/j2sdk1.4.2_12/lib/tools.jar
> /etc/tomcat5/bin/dist/commons-daemon.jar
> /etc/tomcat5/bin/bootstrap.jar
>
> But i am not sure where this is getting set, i do have the following
> in my /tomcat5/bin/startup.sh
>
> export
> CLASSPATH=./mapscript.jar:.:/etc/tomcat5/webapps/my_test/WEB-INF/classes
>
> so why is this not my classpath at run time??
Tomcat does all kinds of weird things to the classpath. Any jars your
webapp needs need to be in its WEB-INF/lib directory.
Cheers,
Gary
Yes i have already done this, no help, could it be that the eclipse
tomcat plugin is setting its own classpath somewhere? I have added
the jar to window -> preferances -> java -> classpath. but maybe i am
missing somthing else. It just seems that the ./startup.sh script in
the tomcat directory does not have any effect when i make changes to
it.