Appendix A. ClassLoaders and JBoss
When a Java application references Java classes, the Java Virtual Machine (JVM) uses a ClassLoader to load them into memory. The Delegation Model was introduced in Java 2 and organizes ClassLoaders into the following tree/hierarchy by using parent/child relationships, as shown in Figure A-1.
The J2SE ClassLoaders do the following:
The Bootstrap (also called the primordial) ClassLoader has no parent, is the root of the ClassLoader tree, and loads core Java classes (
java.*
) into the JVM.The Extension ClassLoader loads extension classes:
Classes that extend core Java classes—javax.*.
Classes from the Java Runtime Environment (JRE) lib/ext directory in the standard J2SE installation.
The System (also called the Application) ClassLoader loads classes and JARs from the system
CLASSPATH
—theCLASSPATH
environment variable and theclasspath
argument on thejava
command line.
If the current ClassLoader previously loaded a class, then the
ClassLoader returns the class to the client. If a class has not been
previously loaded, then according to the Java specification, a ClassLoader
must defer (or delegate) to its parent before trying to load the class
itself. For example, if an application references java.lang.String
, the System ClassLoader delegates to the Extension ClassLoader, which in turn defers to the Bootstrap ...
Get JBoss at Work: A Practical Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.