Class Loader follows delegation model

even though we create several instance of object, class is only loaded into memory once.

check if the class already in the method area, if not, load the class

If not it will throw a NoClassDefFoundException or a ClassNotFoundException at runtime.

Type of Class Loader

The Bootstrap class loader

also known as the Primordial classloader

is responsible for loading the API classes that come with the JDK installation.

These classes are inside the rt.jar under JDK/JRE/lib folder.

These are ready to use libraries that we can use in every Java program. This class loader comes with every Java installation

and typically it is written in a low level programming language like C or C++.

The Extension class loader

loads the classes from the ext folder of the JRE/lib. So whatever jars we put under the ext, could

be security jar, JDBC jar, etc; those classes will be loaded by the Extension class loader.

Application class loader

class loader is the child of Extension class loader and it is responsible for loading all our application

classes that we write which we put on the classpath environment variable.

It is also implemented in Java.

And the class name is sun.misc.Launcher$ApplicationClassLoader.class.

results matching ""

    No results matching ""