*********** 0 ****************
ananthakrishnan wrote:

> hi,
> I would like to know in order to user the request dispatcher objects is
> the servlet.jar available in the sun site sufficient.
> Where to include it in my path. Like is it sufficient if i copy the jar
> file onto my
> c:\jdk1.2.2\jre\lib\ext path
> thanks in advance
> Anantha Krishnan
> [...]

*********** 1 ****************
>whenever u r including any jar file inot classpath
>u should give the name of jar file too.
>so u should add following in ur classpath if u hv
>copied servlet.jar into c:\jdk1.2.2\jre\lib\ext path
>" c:\jdk1.2.2\jre\lib\ext path\servlet.jar"
[...]

*********** 2 ****************
System ClassLoader does this for you, when you put anything in your ext
directory.No need for setting up the classpath.
try and share your experience
~sanjay
[...]



Hi :-),   I also guess at least there are three ways:

  *  with ExtClassLoader: put the new version of servlet.jar
       in JAVA_HOME\jre\lib\ext folder
  *  with SystemClassLoader: put the new version of servlet.jar
       in CLASSPATH
  *  put the new version of servlet.jar in a special folder defined
       by your Servlet container. so perhaps the Servlet container
       can find it and load it by:
       - 3 parameters Class.forName:
          public static Class forName(String name,
          boolean initialize,
         ClassLoader loader)
       - ...


   *  because from my understanding,  perhaps the delegation model
       from jdk 1.2+ is:
       customCladdLoader ->
       AppletClassLoader(for Applet)/SystemClassLoader(for App) ->
       ExtClassLoader->
       Primordial-class loader(null ClassLoader)


The following is a good email from JMF enginer, I copy it here
 as a reference.

*************** reference ***********
[...]
In jdk 1.2 and up a delegation model is used when loading
classes using ClassLoader.
You have a hierarchy of class loaders, AppletClassLoader,
ExtClassLoader, Primordial-class loader. The
Primordial-classloader loads core classes like String, Thread etc.

Each class loader delegates the loading to its parent.
Only when the parent cannot load it, the child will load it.
This prevents say String.class from being loaded by the
AppletClassLoader.

Say that the jmf jar files are available from the applet location
as well as lib/ext. The AppletClassLoader delegates loading
of the jmf classes to the ExtClassLoader which delegates it to
Primordial-class loader which cannot find those classes.
Since the ExtClassLoader finds the classes in lib/ext it will
load it.

Also, once a class loader, say ExtClassLoader loads a class,
if that class loads another class, it will delegate loading to
the parent. The AppletClassLoader will not get a chance.

There is another class loader called
SystemClassLoader which reads classes and jar files from the
CLASSPATH. This is done for applications. For applications the
delegation sequence is SystemClassLoader, ExtClassLoader and
Primordial-classloader.

In jdk1.2 and up there is a new method in java/lang/Class.java.
The new method overloads existing method forName and it takes
3 parameters
    public static Class forName(String name, boolean initialize,
                                ClassLoader loader)

You can use this method and load a class from a particular
class loader. Applications can do this without restriction
but in order for applets to invoke this method
the following line should be there in the policy file
  permission java.lang.RuntimePermission("getClassLoader");

When running in jdk1.2 and up, JMF's PluginManager uses the
forName with 3 arguments if necessary.
Say that the PluginManager is loaded by the ExtClassLoader.
The user has a new plugin in the CLASSPATH and he wants
the PluginManager to load it.
The original forName with one argument will only check in
ExtClassLoader and Primordial-classloader and won't find it.
JMF will then attempt to load the class from the
SystemClassLoader using the forName with 3 arguments.

Babu Srinivasan
Java Media Engineer

*************** reference ***********


Bo
Jan.17, 2001

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to