Bookmark Topic Watch Topic
  • New Topic

Java Class Loaders - basics  RSS feed

Bhairava Surya
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • 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,
Rob Spoor
Posts: 21135
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Report post to moderator
After being here for three years you should know better than posting questions in multiple forums. Let's continue here.
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!