Search code examples
javajvmclassloader

Is the Classloader part of the JVM or in the JRE?


I am relatively new to java, so forgive me if this question might seem "Silly". I know that the JVM (Java Virtual Machine) is contained within the JRE (Java Runtime Environment) but I am not sure if the classloader and Execution Engine are part of the JVM.

Most sources that I have read did not specify this. Instead, when describing the components of the JVM they only discuss the 5 components of the Runtime Data Area (i.e. Heap, JVM Stack, Method Area, PC Registers and Native Method Stack). Although my common sense tells that for it to be a complete Virtual Machine it needs the input, Memory & processing, I still need to verify the exact locations of these components.


Solution

  • Based on Classloader wikipedia there are 3 types of classloaders in JRE:

    1. Bootstrap class loader

    This class loader, which is part of the core JVM, is written in native code

    1. Extensions class loader

    It is implemented by the sun.misc.Launcher$ExtClassLoader class

    1. System class loader

    This is implemented by the sun.misc.Launcher$AppClassLoader class

    So i think in conclusion: first one is in JVM the other 2 is in JRE libraries.

    • also there are some user defined classloaders which are located in different places (e.g. tomcat, etc)