编程语言
首页 > 编程语言> > Java 9中的类加载器层次结构

Java 9中的类加载器层次结构

作者:互联网

Java-8开始,我知道类加载器的层次结构如下: –

Bootstrap classloader -> Extension classloader -> Application classloader

Java 9中类加载器层次结构的变化是什么?它是如何工作的?

解决方法:

在Java-9中修订的ClassLoader声明:

The Java run-time has the following built-in class loaders:

  • Bootstrap class loader: The virtual machine’s built-in class loader typically represented as null, and does not have a parent.

  • Platform class loader:
    To allow for upgrading/overriding of modules defined to the platform
    class loader, and where upgraded modules read modules defined to class
    loaders other than the platform class loader and its ancestors, then
    the platform class loader may have to delegate to other class loaders,
    the application class loader for example. In other words, classes in
    named modules defined to class loaders other than the platform class
    loader and its ancestors may be visible to the platform class loader
    .

  • System class loader: It is also known as application class loader and is distinct from the platform class loader. The system
    class loader is typically used to define classes on the application
    class path, module path, and JDK-specific tools
    . The platform class
    loader is a parent or an ancestor of the system class loader that all
    platform classes are visible to it.

标签:java-module,java,classloader,java-9
来源: https://codeday.me/bug/20190928/1827140.html