What is classloader in java

What is classloader in java ?

Answer : Java Classloader is a part of the JRE (Java Runtime Environment) that dynamically loads Java classes into the Java Virtual Machine and Usually classes are only loaded on demand. The Java run time system does not need to know about files and file systems because of classloaders.

Each Java class library is loaded by a class loader. When the JVM is start up there are three class loaders that5 is reponsible for to load the classes as mentioned below:

  • Bootstrap class loader : Bootstrap class loader loads all java library which is located in <JAVA_HOME>/jre/lib directory
  • Extensions class loader : Extension class loader loads classes which is available in <JAVA_HOME>/jre/lib/ext folder
  • System class loader : Extension class loader loads classes which is found in system classpath where it maps to classpath environment variable. This has been implemented by the sun.misc.Launcher$AppClassLoader class.

Leave a Reply

Your email address will not be published. Required fields are marked *