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.
I am still confused as Classloader is also a class, so who will load this BootStrapClassloader?
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.
I am still confused as Classloader is also a class, so who will load this BootStrapClassloader?
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.
The Bootstrap Classloader, being a classloader and all, is actually a part of the JVM Core and it is written in native code.
Classloaders can be objects, they need a representation too. In fact, this also allows the creation of user-defined classloaders.
There is an idiom in English, "He pulled himself up by his bootstraps." The boot straps are the little handles of the top sides of boots and, of course, its impossible.
http://en.wikipedia.org/wiki/Booting
The article explains the process of booting a computer, which is short for bootstrapping.
What happens with every program of every type is that a loader of some sort copies some bytes into memory somewhere and begins execution at a predefined place in those bytes.
For Java, the boot strap loader may or may not be a Java class. (Someone probably knows.) But it is a program of some sort that loads the very first few classes into memory and causes the JVM to begin executing those bits of loaded Java code. Maybe it loads the JVM code itself. Maybe it just makes sure some prior bit of code loaded the JVM. Maybe, it even requires the JVM to have already been loaded and running.
Its just part of the process.
JDK installed path: jdk\jre\lib\rt.jar
this location is called bootstrap class path. Bootstrap class loader is responsible to load classes from bootstrap class path.
Bootstrap class loader is by default available with the JVM. It is implemented in Native Language Like C and C++.
© 2022 - 2024 — McMap. All rights reserved.