public static ClassLoader | Gets a ClassLoader that can be used to access resources defined by the bootstrap class loader. |
public static InputStream | Opens an input stream for the resource with the given name in the bootstrap classloader. |
public static URL | Finds a resource URL in the bootstrap classloader. |
public static Enumeration< | Finds resources in the bootstrap classloader. |
public static ClassLoader | Returns the classloader which should be used as a parent to new classloaders in order to access the JRE classes. |
As the bootstrap class loader is represented by the null
parent class loader, it is not possible to
directly access resources of it. You need to create a new instance of ClassLoader with null
parent to access resources from it.
This method returns a such class loader, which has null
as its parent, and doesn't load any classes.
In general there is no use for using the class loader returned by this method, however it can be useful when
subclassing ClassLoader and implementing complex functionality.
See the documentation of ClassLoader for more info about the bootstrap class loader.
null
parent and loads no classes.
This method calls ClassLoader.getResourceAsStream(
null
if not found.
This method calls ClassLoader.getResource(
null
.
This method calls ClassLoader.getResources(
This is important to use, when compatibility with JDK 8 and the JDK 9+ should be achieved.
For example, when one wants to load Processor, it is necessary on JDK 9+ to have the platform classloader
as a parent, as the default null
parent doesn't contain the requested class. On JDK 8, this will
return null
, as the classloaders delegate the loading to the bootstrap classloader, which contains
all the JRE classes. On JDK 9+, this will return ClassLoader.getPlatformClassLoader()