清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
String className = Appender.class.getName(); className = className.replace('.', '/'); String resource = "/" + className + ".class"; URL url = Appender.class.getResource(resource); System.out.println(url.getFile());
//输出结果:
//file:/E:/JavaLib/log4j/log4j-1.2.14.jar!/org/apache/log4j/Appender.class