APIdia Launch Partner
Top Description Inners Fields Constructors Methods
jdk.internal.loader

public Class BootLoader

extends Object
Class Inheritance
Imports
java.io.IOException, .InputStream, java.lang.module.ModuleReference, java.net.MalformedURLException, .URI, .URL, java.nio.file.Files, .Path, java.util.Arrays, .Enumeration, java.util.concurrent.ConcurrentHashMap, java.util.jar.JarInputStream, .Manifest, java.util.stream.Stream, jdk.internal.access.JavaLangAccess, .SharedSecrets, jdk.internal.module.Modules, .ServicesCatalog, jdk.internal.util.StaticProperty

Find resources and packages in modules defined to the boot class loader or resources and packages on the "boot class path" specified via -Xbootclasspath/a.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
pack-priv static class
BootLoader.PackageHelper

Helper class to define Package objects for packages in modules defined to the boot loader.

Field Summary

Modifier and TypeField and Description
private static final ConcurrentHashMap<?, ?>
private static final String
private static final JavaLangAccess
private static final Module

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static Package
definePackage(Class<?> c)

Define a package for the given class to the boot loader, if not already defined.

public static URL
findResource(String mn, String name)

Returns a URL to a resource in a module defined to the boot loader.

public static URL
findResource(String name)

Returns the URL to the given resource in any of the modules defined to the boot loader and the boot class path.

public static InputStream
findResourceAsStream(String mn, String name)

Returns an input stream to a resource in a module defined to the boot loader.

public static Enumeration<URL>
findResources(String name)

Returns an Iterator to iterate over the resources of the given name in any of the modules defined to the boot loader.

public static ConcurrentHashMap<?, ?>
getClassLoaderValueMap()

Returns the ClassLoaderValue map for the boot class loader.

public static Package
getDefinedPackage(String pn)

Returns the Package of the given name defined to the boot loader or null if the package has not been defined.

public static NativeLibraries
getNativeLibraries()

Returns NativeLibraries for the boot class loader.

public static ServicesCatalog
getServicesCatalog()

Returns the ServiceCatalog for modules defined to the boot class loader.

private static native String
getSystemPackageLocation(String name)

Returns the location of the package of the given name, if defined by the boot loader; otherwise null is returned.

private static native String[]
getSystemPackageNames()

Returns an array of the binary name of the packages defined by the boot loader, in VM internal form (forward slashes instead of dot).

public static Module
getUnnamedModule()

Returns the unnamed module for the boot loader.

public static boolean
hasClassPath()

Returns true if there is a class path associated with the BootLoader.

public static Class<?>
loadClass(Module module, String name)

Loads the Class object with the given name in the given module defined to the boot loader.

public static Class<?>
loadClassOrNull(String name)

Loads the Class object with the given name defined to the boot loader.

public static void
loadLibrary(String name)

Loads a native library from the system library path.

public static void
loadModule(ModuleReference mref)

Registers a module with this class loader so that its classes (and resources) become visible via this class loader.

public static Stream<Package>
packages()

Returns a stream of the packages defined to the boot loader.

private static native void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

CLASS_LOADER_VALUE_MAPback to summary
private static final ConcurrentHashMap<?, ?> CLASS_LOADER_VALUE_MAP
JAVA_HOMEback to summary
private static final String JAVA_HOME
JLAback to summary
private static final JavaLangAccess JLA
UNNAMED_MODULEback to summary
private static final Module UNNAMED_MODULE

Constructor Detail

BootLoaderback to summary
private BootLoader()

Method Detail

definePackageback to summary
public static Package definePackage(Class<?> c)

Define a package for the given class to the boot loader, if not already defined.

findResourceback to summary
public static URL findResource(String mn, String name) throws IOException

Returns a URL to a resource in a module defined to the boot loader.

findResourceback to summary
public static URL findResource(String name)

Returns the URL to the given resource in any of the modules defined to the boot loader and the boot class path.

findResourceAsStreamback to summary
public static InputStream findResourceAsStream(String mn, String name) throws IOException

Returns an input stream to a resource in a module defined to the boot loader.

findResourcesback to summary
public static Enumeration<URL> findResources(String name) throws IOException

Returns an Iterator to iterate over the resources of the given name in any of the modules defined to the boot loader.

getClassLoaderValueMapback to summary
public static ConcurrentHashMap<?, ?> getClassLoaderValueMap()

Returns the ClassLoaderValue map for the boot class loader.

getDefinedPackageback to summary
public static Package getDefinedPackage(String pn)

Returns the Package of the given name defined to the boot loader or null if the package has not been defined.

getNativeLibrariesback to summary
public static NativeLibraries getNativeLibraries()

Returns NativeLibraries for the boot class loader.

getServicesCatalogback to summary
public static ServicesCatalog getServicesCatalog()

Returns the ServiceCatalog for modules defined to the boot class loader.

getSystemPackageLocationback to summary
private static native String getSystemPackageLocation(String name)

Returns the location of the package of the given name, if defined by the boot loader; otherwise null is returned. The location may be a module from the runtime image or exploded image, or from the boot class append path (i.e. -Xbootclasspath/a or BOOT-CLASS-PATH attribute specified in java agent).

getSystemPackageNamesback to summary
private static native String[] getSystemPackageNames()

Returns an array of the binary name of the packages defined by the boot loader, in VM internal form (forward slashes instead of dot).

getUnnamedModuleback to summary
public static Module getUnnamedModule()

Returns the unnamed module for the boot loader.

hasClassPathback to summary
public static boolean hasClassPath()

Returns true if there is a class path associated with the BootLoader.

loadClassback to summary
public static Class<?> loadClass(Module module, String name)

Loads the Class object with the given name in the given module defined to the boot loader. Returns null if not found.

loadClassOrNullback to summary
public static Class<?> loadClassOrNull(String name)

Loads the Class object with the given name defined to the boot loader.

loadLibraryback to summary
public static void loadLibrary(String name)

Loads a native library from the system library path.

loadModuleback to summary
public static void loadModule(ModuleReference mref)

Registers a module with this class loader so that its classes (and resources) become visible via this class loader.

packagesback to summary
public static Stream<Package> packages()

Returns a stream of the packages defined to the boot loader.

setBootLoaderUnnamedModule0back to summary
private static native void setBootLoaderUnnamedModule0(Module module)
jdk.internal.loader back to summary

private Class BootLoader.Holder

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private static final NativeLibraries

Constructor Summary

AccessConstructor and Description
private

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

NATIVE_LIBSback to summary
private static final NativeLibraries NATIVE_LIBS

Constructor Detail

Holderback to summary
private Holder()
jdk.internal.loader back to summary

pack-priv Class BootLoader.PackageHelper

extends Object
Class Inheritance

Helper class to define Package objects for packages in modules defined to the boot loader.

Field Summary

Modifier and TypeField and Description
private static final JavaLangAccess

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv static Package
definePackage(String
package name
name
,
String
location where the package is (jrt URL or file URL for a named module in the run-time or exploded image; a file path for a package from -Xbootclasspath/a)
location
)

Define the Package with the given name.

private static Module
findModule(String location)

Finds the module at the given location defined to the boot loader.

private static Manifest
getManifest(String location)

Returns the Manifest if the given location is a JAR file containing a manifest.

private static URL
toFileURL(String location)

Returns URL if the given location is a regular file path.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

JLAback to summary
private static final JavaLangAccess JLA

Constructor Detail

PackageHelperback to summary
pack-priv PackageHelper()

Method Detail

definePackageback to summary
pack-priv static Package definePackage(String name, String location)

Define the Package with the given name. The specified location is a jrt URL to a named module in the run-time image, a file URL to a module in an exploded run-time image, or a file path to an entry on the boot class path (java agent Boot-Class-Path or -Xbootclasspath/a.

If the given location is a JAR file containing a manifest, the defined Package contains the versioning information from the manifest, if present.

Parameters
name:String

package name

location:String

location where the package is (jrt URL or file URL for a named module in the run-time or exploded image; a file path for a package from -Xbootclasspath/a)

findModuleback to summary
private static Module findModule(String location)

Finds the module at the given location defined to the boot loader. The module is either in runtime image or exploded image. Otherwise this method returns null.

getManifestback to summary
private static Manifest getManifest(String location)

Returns the Manifest if the given location is a JAR file containing a manifest.

toFileURLback to summary
private static URL toFileURL(String location)

Returns URL if the given location is a regular file path.