首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >迭代jar文件中的类

迭代jar文件中的类
EN

Stack Overflow用户
提问于 2010-03-03 19:47:32
回答 2查看 5.1K关注 0票数 3

有人知道在Jar文件中迭代类的2-3行解决方案吗?

(我手中有一个java.net.URL实例)

谢谢

EN

回答 2

Stack Overflow用户

发布于 2010-03-03 19:52:59

Accessing zips and jars using Java Part 1

Accessing zips and jars using Java Part 2

以下是第一篇文章中的代码片段:

代码语言:javascript
运行
复制
  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();
  }
票数 4
EN

Stack Overflow用户

发布于 2010-03-03 19:59:31

jar -tf xyz.jar|grep类

Here's a solution。您可以从URL而不是代码使用的文件创建输入流。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/2370867

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档