JVM Tutorials - Herong's Tutorial Examples
Dr. Herong Yang, Version 4.10

What Is java.lang.ClassLoader Class?

This section describes what is java.lang.ClassLoader class - A built-in abstract class that represents ClassLoaders used in JRE to load dynamically Java classes into the JVM.

What Is java.lang.ClassLoader Class? ClassLoader is a built-in abstract class that represents ClassLoaders used in Java Runtime Environment (JRE) to load dynamically Java classes into the Java Virtual Machine (JVM).

If you want to create your own ClassLoader to your own classes in some special ways, you should define a concrete subclass of java.lang.ClassLoader.

java.lang.ClassLoader class offers these main methods:

  • ClassLoader getParent() - Returns the parent ClassLoader of delegation tree.
  • static ClassLoader getSystemClassLoader() - Returns the system ClassLoader.
  • public Class<?> loadClass(String name) - Loads the class with the specified binary name.
  • URL getResource(String name) - Finds the resource with the given name.
  • Enumeration<URL> getResources(String name) - Finds all the resources with the given name.
  • static URL getSystemResource(String name) - Find a resource of the specified name from the search path used to load classes.
  • static Enumeration<URL> getSystemResources(String name) - Finds all resources of the specified name from the search path used to load classes.

Last update: 2010.

Table of Contents

 About This Book

 Download and Install Java SE 1.6 Update 2

 java.lang.Runtime Class - The JVM Instance

 java.lang.System Class - The Operating System

ClassLoader Class - Class Loaders

 What Is Class Loader?

What Is java.lang.ClassLoader Class?

 Accessing the ClassLoader of a Class

 JVM "-verbose:class" Option

 loadClass() Method - Loading Classes Explicitly

 getSystemResource() Method - Finding Files

 Class Loading Problem - JAR Hell

 Class Class - Class Reflections

 Sun's JVM - Java HotSpot VM

 JRockit JVM 7.0 by BEA Systems

 JRockit JVM 8.0 by BEA Systems

 Memory Management Rules and Tests

 Garbage Collection Tests

 Stack Overflow Tests

 Thread Testing Program and Result

 StringBuffer Testing Program and Result

 CDS (Class Data Sharing)

 Micro Benchmark Runner and JVM Options

 Micro Benchmark Tests on "int" Operations

 Micro Benchmark Tests on "long" Operations

 Micro Benchmark Tests in JIT Compilation Mode

 Micro Benchmark Tests on "float" and "double" Operations

 References

 PDF Printing Version

Dr. Herong Yang, updated in 2010
What Is java.lang.ClassLoader Class?