Javabench is a collection of Java tutorials, sample code / examples, articles, interview questions & answers, OCP JP (formerly SCJP) qu...
Friday, February 24, 2012
Java class loading process - How is Bootstrap/Primordial Classloader loaded?
If Java classes are loaded by classloaders, and classloaders are Java components, who loads the first classloader?
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.