What class loaders are created by the module system?
Note: These pages are being reviewed.
This FAQ item should be a companion to the main classpath documentation. Please refer to the original document for additional details.
There are basically three main class loader types used in the platform.
Most code is loaded by module class loaders.
In special cases the "system" class loader can be used,
when you need access to resources from unknown modules.
Resources directly on the classpath from the launch script (mainly
are loaded by the application loader.
(There are also bootstrap and extension loaders in the JRE,
and the platform has a special loader for a couple of JARs in
Most of the class loaders in the NetBeans platform are multi-parented class loaders.
This means that the class loader can have zero or more parents.
org.netbeans.ProxyClassLoader implements the search across multiple parents.
Every module loaded by the module system has its own class loader. This loader loads resources primarily from the module’s JAR. The application loader is an implicit parent of each module loader.
The module loader is able to load from additional JARs (besides delegating to various parents):
extensions - anything listed in the manifest attribute
Class-Pathof the module JAR
locale extensions - JARs placed in a subdirectory
localerelative to the original module JAR position, named by appending a locale suffix to the original name
patches - JARs placed in a subdirectory
patches/code-name-baserelative to the original JAR position (can override module classes)
The implementation class is
The "system" loader loads no resources on its own,
but has as its parents all enabled module’s class loaders.
It is accessible via
or by using the fact that it is the context loader on all threads by default:
This class loader is set up by the launch script (or by
javaws if running in JNLP mode).
It can load classes from
lib/*.jar in specified clusters.
It is generally discouraged to use this loader for your own classes,
but it is sometimes needed e.g. for Look & Feel classes
(which must be loaded very early during the startup sequence).
Take a very simple module
Manifest-Version: 1.0 OpenIDE-Module: org.netbeans.modules.a
b depending on
Manifest-Version: 1.0 OpenIDE-Module: org.netbeans.modules.b OpenIDE-Module-Module-Dependencies: org.netbeans.modules.a Class-Path: ext/library-b-1.1.jar
org-netbeans-modules-a.jar will be loaded in
a’s module class loader.
Classes in both `org-netbeans-modules-b.jar and
will be loaded in
b’s module loader,
and can refer to classes in `org-netbeans-modules-a.jar.
Applies to: NetBeans 6.8 and above