有人知道用于迭代某些 Jar 文件中的类的 2-3 行解决方案吗?
(我手里有一个java.net.URL的实例)
Thanks
使用 Java 访问 zip 和 jar 文件第 1 部分 http://www.developer.com/tech/article.php/607681/Accessing-zips-and-jars-using-Java-Part-1
使用 Java 访问 zip 和 jar 文件第 2 部分 http://www.developer.com/tech/article.php/607931/Accessing-zips-and-jars-using-Java-Part-2
这是第一篇文章中的代码片段:
ZipFile zip = new ZipFile(fileName);
// Process the zip file. Close it when the block is exited.
try {
// Loop through the zip entries and print the name of each one.
for (Enumeration list = zip.entries(); list.hasMoreElements(); ) {
ZipEntry entry = (ZipEntry) list.nextElement();
System.out.println(entry.getName());
}
}
finally {
zip.close();
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)