[import os]查看import的类是出自哪个jar包的方法

更新时间:2021-07-25    来源:Dom教程    手机版     字体:

【www.bbyears.com--Dom教程】

 

 代码如下

publicstaticvoidmain(String[] args) {       

        ProtectionDomain pd = StringUtils.class.getProtectionDomain();

        CodeSource cs = pd.getCodeSource();

        System.out.println(cs.getLocation());

    }

 

打印出:file:/D:/work_ser_demo/springtest/WebContent/WEB-INF/lib/commons-lang-2.4.jar

本文来源:http://www.bbyears.com/wangyezhizuo/131935.html