有人知道迭代某些 Jar 文件中的类的 2-3 行解决方案吗?
(我手里有一个 java.net.URL 的实例)
谢谢
最佳答案
Accessing zips and jars using Java Part 1
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();
}
关于java - 遍历 jar 文件中的类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2370867/