zoukankan      html  css  js  c++  java
  • 类加载器

    类加载器

    类加载器的作用


    代码如下

    public class Test07 {
        public static void main(String[] args) throws ClassNotFoundException {
    
            //获取系统类的加载器
            ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader();
            System.out.println(systemClassLoader);
    
            //获取系统类加载器的父类加载器-->扩展类加载器
            ClassLoader parent = systemClassLoader.getParent();
            System.out.println(parent);
    
            //获取扩展类加载器的父类加载器-->根加载器(C/c++)
            ClassLoader parent1 = parent.getParent();
            System.out.println(parent1);
    
            //测试当前类是哪个加载器加载的
            ClassLoader classLoader = Class.forName("com.lu.reflection.Test07").getClassLoader();
            System.out.println(classLoader);
    
            //测试JDK内置的类是谁加载的
            classLoader = Class.forName("java.lang.Object").getClassLoader();
            System.out.println(classLoader);
    
            //如何获得系统类加载器可以加载的路径
    
            System.out.println(System.getProperty("java.class.path"));
            
            //双亲委派机制 
            //多重检测安全性
                //java.lang.String -->
            
            /*
            C:Program FilesJavajdk1.8.0_231jrelibcharsets.jar;
            C:Program FilesJavajdk1.8.0_231jrelibdeploy.jar;
            C:Program FilesJavajdk1.8.0_231jrelibextaccess-bridge-64.jar;
            C:Program FilesJavajdk1.8.0_231jrelibextcldrdata.jar;
            C:Program FilesJavajdk1.8.0_231jrelibextdnsns.jar;
            C:Program FilesJavajdk1.8.0_231jrelibextjaccess.jar;
            C:Program FilesJavajdk1.8.0_231jrelibextjfxrt.jar;
            C:Program FilesJavajdk1.8.0_231jrelibextlocaledata.jar;
            C:Program FilesJavajdk1.8.0_231jrelibext
    ashorn.jar;
            C:Program FilesJavajdk1.8.0_231jrelibextsunec.jar;
            C:Program FilesJavajdk1.8.0_231jrelibextsunjce_provider.jar;
            C:Program FilesJavajdk1.8.0_231jrelibextsunmscapi.jar;
            C:Program FilesJavajdk1.8.0_231jrelibextsunpkcs11.jar;
            C:Program FilesJavajdk1.8.0_231jrelibextzipfs.jar;
            C:Program FilesJavajdk1.8.0_231jrelibjavaws.jar;
            C:Program FilesJavajdk1.8.0_231jrelibjce.jar;
            C:Program FilesJavajdk1.8.0_231jrelibjfr.jar;
            C:Program FilesJavajdk1.8.0_231jrelibjfxswt.jar;
            C:Program FilesJavajdk1.8.0_231jrelibjsse.jar;
            C:Program FilesJavajdk1.8.0_231jrelibmanagement-agent.jar;
            C:Program FilesJavajdk1.8.0_231jrelibplugin.jar;
            C:Program FilesJavajdk1.8.0_231jrelib
    esources.jar;
            C:Program FilesJavajdk1.8.0_231jrelib
    t.jar;
            C:Users99714DesktopJavaSEoutproduction基础语法;
            C:Users99714DesktopJavaSE基础语法srccomlibcommons-io-2.7.jar;
            D:IntelliJ IDEA 2019.2.4libidea_rt.jar
    
             */
        }
    }
    
  • 相关阅读:
    MySQL Execution Plan--合理利用隐式的业务逻辑
    MySQL Table--MySQL外键
    MySQL倒序索引测试2
    MySQL倒序索引测试1
    CCNA-3.硬件介质
    CCNA-2.OSI 7层网络模型
    CCNA-1.认识网络
    windows本地安装Oracle数据库
    扫码登录实现原理
    phpunit 单元测试
  • 原文地址:https://www.cnblogs.com/helloxiaolu/p/13326850.html
Copyright © 2011-2022 走看看