How is the Java Bootstrap Classloader loaded?

Sunny Gupta picture Sunny Gupta · Aug 13, 2013 · Viewed 33.7k times · Source

In java, it is said that all the classes are being loaded by classloaders.

So first of all, bootstrap classloader loads all the rt.jar classes.

So I am still confused as Classloader is also a class, so who will load this BootStrapClassloader.

Kindly explain.

Answer

Raúl picture Raúl · Apr 10, 2015

Answer : When a JVM starts up, a special chunk of machine code runs that loads the system classloader. This machine code is known as the Bootstrap / Primordial (or sometimes - Null) classloader.

It is not a Java class at all, as are all other classloaders. The bootstrap classloader is platform specific machine instructions that kick off the whole classloading process.

All classloaders, with the exception of the bootstrap classloader, are implemented as Java classes. Something must load the very first Java classloader to get the process started. Loading the first pure Java classloader is the job of the bootstrap classloader.

The bootstrap classloader also takes care of loading all of the code needed to support the basic Java Runtime Environment (JRE), including classes in the java.util and the java.lang packages.

Source: http://www.theserverside.com/tutorial/Classloaders-Demystified-Understanding-How-Java-Classes-Get-Loaded-in-Web-Applications