It is a component of the Java Runtime Environment that allows the Java Virtual Machine to dynamically load class files (JVM). When a java file is run, the classloader is triggered.
In Java, there are three different types of classloaders:
Bootstrap Classloader: The bootstrap classloader is a superclass of extension classloader that loads the standard JDK files from rt.jar as well as other essential classes. The rt.jar file contains all of the java.lang, java.util, java.sql, and other package classes.
Extension Classloader: The extension classloader is the child of the Bootstrap classloader and the parent of the System classloaders. It only loads files from the extension classpath, which is located in the ‘ext.dirs/JRE/lib/ext directory. The extension classloader will delegate the file to the System classloader if it is not found in the specified directory.
System/Application Classloader: It loads application-specific classes via the environment variable -classpath or the command-line option -cp. If the class is not found in the application classpath, the application classloader throws a ClassNotFoundException.