序
本文主要研究一下java9的classloader
java9之前的classloader
- bootstrap classloader加载rt.jar,jre/lib/endorsed
- ext classloader加载jre/lib/ext
- application classloader加载-cp指定的类
java9及之后的classloader
- bootstrap classloader加载lib/modules
java.base java.security.sasljava.datatransfer java.xmljava.desktop jdk.httpserverjava.instrument jdk.internal.vm.cijava.logging jdk.managementjava.management jdk.management.agentjava.management.rmi jdk.naming.rmijava.naming jdk.netjava.prefs jdk.sctpjava.rmi jdk.unsupported
- ext classloader更名为platform classloader,加载lib/modules
java.activation* jdk.accessibilityjava.compiler* jdk.charsetsjava.corba* jdk.crypto.cryptokijava.scripting jdk.crypto.ecjava.se jdk.dynalinkjava.se.ee jdk.incubator.httpclientjava.security.jgss jdk.internal.vm.compiler*java.smartcardio jdk.jsobjectjava.sql jdk.localedatajava.sql.rowset jdk.naming.dnsjava.transaction* jdk.scripting.nashornjava.xml.bind* jdk.security.authjava.xml.crypto jdk.security.jgssjava.xml.ws* jdk.xml.domjava.xml.ws.annotation* jdk.zipfs
- application classloader加载-cp,-mp指定的类
jdk.aot jdk.jdepsjdk.attach jdk.jdijdk.compiler jdk.jdwp.agentjdk.editpad jdk.jlinkjdk.hotspot.agent jdk.jshelljdk.internal.ed jdk.jstatdjdk.internal.jvmstat jdk.packjdk.internal.le jdk.policytooljdk.internal.opt jdk.rmicjdk.jartool jdk.scripting.nashorn.shelljdk.javadoc jdk.xml.bind*jdk.jcmd jdk.xml.ws*jdk.jconsole
小结
java9模块化之后,对classloader有所改造,其中一点就是将ext classloader改为platform classloader,另外模块化之后,对应的classloader加载各自对应的模块。