In Java2, ClassLoaders got much fancier.

The "null" ClassLoader is the bootstrap loader, which is used to load
things in the boot classpath (sun.boot.class.path).

Applications, on the other hand, are loaded by the AppClassLoader (subclass
of URLClassLoader, IIRC), so this is NOT the so-called boot loader.

A big advantage of non-boot ClassLoaders is that, if/when they are GC'd,
all the java.lang.Class objects they loaded can be GC'd, too.

-blair

Blair Wyman -- iSeries JVM -- (507) 253-2891
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"It is a sobering thought that when Mozart was my age,
he had been dead for two years." -- Tom Lehrer



                                                                                       
                                                
                      RAMESH                                                           
                                                
                      VISHNUVARDHAN            To:       "JDJList" 
<[EMAIL PROTECTED]>                                       
                      <[EMAIL PROTECTED]>        cc:                                     
                                                
                                               Subject:  [jdjlist] RE: Classloader is 
null                                             
                      05/24/2002 10:35                                                 
                                                
                      AM                                                               
                                                
                      Please respond to                                                
                                                
                      "JDJList"                                                        
                                                
                                                                                       
                                                
                                                                                       
                                                



Upto my knowledge, the main class will be loaded by the bootstrap
classloader.When i execute the following code I get
sun.misc.Launcher$AppClassLoader@7fdcde. I think this is the bootstrap
classloader.

public class Test{
public static void main(String args[]) {
    System.out.println(Test.class.getClassLoader());
}

}


-----Original Message-----

From: Fewtrell, Tom

To: JDJList

Sent: 5/24/02 5:05 PM

Subject: [jdjlist] RE: Classloader is null



The javadoc contains the following for Class's getClassLoader() method:



"Some implementations may use null to represent the bootstrap class

loader.

This method will return null in such implementations if this class was

loaded by the bootstrap class loader."



Is the bootstrap classloader used for Strings? or maybe something to do

with

bootstrapping for the main method?





-----Original Message-----

From: RAMESH VISHNUVARDHAN [mailto:[EMAIL PROTECTED]]

Sent: Friday, May 24, 2002 3:48 PM

To: JDJList

Subject: [jdjlist] Classloader is null





Hi all,



I am executing the following code:



public class Test{

public static void main(String args[]) {

    System.out.println(new String().getClass().getClassLoader());

}



}



I am getting the output as null. How can be a class without classloader?

Can

anybody explain why am i getting null.





Regards,

Vishnu



To change your membership options, refer to:

http://www.sys-con.com/java/list.cfm



This e-mail and any attachment is for authorised use by the intended

recipient(s) only.  It may contain proprietary material, confidential

information and/or be subject to legal privilege.  It should not be

copied, disclosed to, retained or used by, any other party.  If you are

not an intended recipient then please promptly delete this e-mail and

any attachment and all copies and inform the sender.  Thank you.



To change your membership options, refer to:

http://www.sys-con.com/java/list.cfm


To change your membership options, refer to:
http://www.sys-con.com/java/list.cfm






To change your membership options, refer to:
http://www.sys-con.com/java/list.cfm

Reply via email to