Is the Classloader part of the JVM or in the JRE?
Based on Classloader wikipedia there are 3 types of classloaders in JRE:
- Bootstrap class loader
This class loader, which is part of the core JVM, is written in native code
- Extensions class loader
It is implemented by the sun.misc.Launcher$ExtClassLoader class
- 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)
I don't think it is possible to make a clear distinction.
JRE is the name for a kind of Java distribution, which (incidentally) Oracle don't provide anymore.
JVM (Java virtual machine) is a more abstract term. It refers to "a thing that executes Java programs". In practical terms, it consists of a core written in native code and a large amount of Java code. But there is no clear line drawn between the virtual machine and the libraries that support the virtual machine and other that are "part of Java" that the virtual machine runs.
The java.lang.Classloader
class is a good example of this. Some of it is written in Java. Other parts are native code methods which are provided by the JVM native code core. All other classloader classes extend
the ClassLoader
. Some are part of the standard library, and others may come from third party libraries or frameworks, or may be implemented by the application itself.
Then there is the bootstrap classloader which is entirely written in native code, and shares code with the native code methods of ClassLoader
.
In short, I don't think it is possible to get a clear answer. And I don't think attempting or succeeding in drawing a hard line around the JVM would actually achieve anything.