ClassLoader - Chargeur de classe

JVM ClassLoader

Chaque classe est loadée par une instance de java.lang.ClassLoader

A chaque fois qu'une nouvelle JVM est démarrée le "bootstrap class loader" (chargeur de classe au démarrage) est responsable de charger en premier en mémoire les classes java de base (java.lang.Object) et d'autre runtime. Les classes runtime sont packagées dans le fichier JRE\lib\rt.jar.

ExtClassLoader

Class loader des extensions: java.ext.dirs

AppClassLoader -

The application class loader is responsible for loading all of the classes kept in the path corresponding to the java.class.path system property.

How Class Loaders Work

All class loaders except the bootstrap class loader have a parent class loader. Moreover, all class loaders are of the type java.lang.ClassLoader. The parent class loader for any class loader is the class loader instance that loaded that class loader. (Remember, a class loader is itself a class!)

Code static

If some static initialization code is put in the Target class, and if we want this code to be executed one and only once in a JVM, in our current setup the code will be executed twice in the JVM: once each when the class is loaded separately by both CustomClassLoaders.

Liens