What is the role for a ClassLoader in Java?
A Java program is made up of a number of custom classes (written by programmers like us) and core classes (which come pre-packaged with Java). When a program is executed, JVM needs to load the content of all the needed class. JVM uses a ClassLoader to find the classes.
Three Type of Class Loaders are in Java
1. System Class Loader - Loads all classes from CLASSPATH
2. Extension Class Loader - Loads all classes from extension directory
3. Bootstrap Class Loader - Loads all the Java core files
When JVM needs to find a class, it starts with System Class Loader. If it is not found, it checks with Extension Class Loader. If it not found, it goes to the Bootstrap Class Loader. If a class is still not found, a ClassNotFoundException is thrown.
No Comments Yet!!