Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Java Class Loaders - basics

 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Hi All,

I found so many posts regarding the Java Class Loaders in the forum, but nothing is there completely in the forum.
For that reason, I again started this post.

For the best of my knowledge,

Whenever a JVM is started, class loaders are responsible for loading the classes.

Three class loaders are used
1) Bootstrap class loader
2) Extensions class loader
3) System class loader

The bootstrap class loader loads the core Java libraries[5] (<JAVA_HOME>/lib directory). This class loader, which is part of the core JVM, is written in native code.

The extensions class loader loads the code in the extensions directories (<JAVA_HOME>/lib/ext or any other directory specified by the java.ext.dirs system property). It is implemented by the sun.misc.Launcher$ExtClassLoader class.

The system class loader loads code found on java.class.path, which maps to the system CLASSPATH variable. This is implemented by the sun.misc.Launcher$AppClassLoader class.

So consider I have an application of around 10 classes, which are compiled. And the path for this class files is given in the CLASSPATH variable.

So my question here is,

1) Now if the JVM is started, does all the 10 classes will be loaded in the JVM or not (at the time of starting JVM itself)?

2) COnsider all the classes are loaded. Then in one of my classes, consider a statement is there like A a = new A();
the 'new' keyword is used to instantiate the class which is already loaded in JVM right?

3) what are the phases does a class will go before execution, I mean like JSP life cycle thattranslation compilation etc. the same ways what are the phases for a class

Please reply.

Thanks & Regards,
Ravi.
 
Sheriff
Posts: 22784
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
After being here for three years you should know better than posting questions in multiple forums. Let's continue here.
 
She still doesn't approve of my superhero lifestyle. Or this shameless plug:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
    Bookmark Topic Watch Topic
  • New Topic