You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Barry Draper <ba...@informix.com> on 2001/06/02 19:13:17 UTC

Question: Tomcat 3.2.1 servlet and dynamically loading JAR files

Hello.
I have a question about loading JAR files. It is not necessarily specific
to Tomcat, i.e., it is really a generic Java question,
but my application happens to be a servlet running under Tomcat 3.2.1.
The question is this:
Is there a way for a servlet running under Tomcat 3.2.1 to dynamically load
specific versions of JAR files independent of what is specified in the
CLASSPATH, so that all 
references to classes implemented in these JAR files (but possibly
implemented in
other JAR files contained within the CLASSPATH) are guaranteed to be
resolved
by classes contained within the specific, dynamically loaded JAR files 
and not from some other JAR files specified in the CLASSPATH.
I am looking for a Java facility for JAR files which is analogous to
dynamically loading C and C++ libraries on 
Sun Solaris using dlopen or on Windows using the Win32 API function
LoadLibrary.
Can it be done with the java.lang.ClassLoader or some other standard
classes?
Can someone point me to some sample code which demonstrates how to do this?


Thanks.
Barry Draper
barry@informix.com