微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

在一大批罐子中找到特定的类别

如何解决在一大批罐子中找到特定的类别

| 在不同文件夹(Windows)中的大量jar文件中定位类的推荐方法是什么? 目前,我使用editplus搜索,这似乎很棒。但也许我错过了更好的方法? 谢谢。 编辑 我需要不以编程方式找到它。     

解决方法

尝试
cf.jar
Usage:

   java  -jar  cf.jar  SEARCH  [DIRECTORY]  [OPTIONS]...

Searches all JAR files in the current directory and its sub-directories for
entries matching the SEARCH argument. If DIRECTORY is provided,searching will
be done in that location instead of the current directory.

SEARCH:

  A search string containing the class name (entry name). Wild card (*) is
  supported. Package separator can be either of `/\',`\\\' or `.\'.

  Examples:

    java.lang.String
    java/util/ArrayList
    java/lang/Str*B*er

  If non \".class\" entries also need to be searched,option -a (--all-types)
  should be specified. Please see the OPTIONS section for a more detailed
  explanation.

DIRECTORY:

  If this is not provided,current directory and all its sub-directories will
  be used for performing the search. However,if this argument is provided,the same and its sub-directories will be used as the location to fetch JAR
  files from.

  If a recursive scan is not needed,option -s (--shallow) can be specified.

OPTIONS:

  -h          --help
                   Shows this help
  -o [path]   --redirect-output
                   Redirect output to a file path supplied.
  -x [x1,x2]  --archive-extensions
                   Extensions in addition to the default \".jar\". Comma or space
                   separated list accepted.
  -i          --insensitive-case
                   Case insensitive search.
  -q          --quiet
                   Silent search without the progress bar animation.
  -a          --all-types
                   Removes the filtering on \".class\" types so that other types
                   such as \".properties\",\".xml\",etc can also be searched for.
  -s          --shallow
                   Performs a shallow search. Doesn\'t recurse.

Examples:

   java  -jar  cf.jar  org/apache/log4j/Level  D:\\Frameworks
   java  -jar  cf.jar  *OracleDriver  C:\\oracle -x jar,zip
   java  -jar  cf.jar  messages.properties  D:\\IBM\\WebSphere -a -x jar,war,ear
   java  -jar  cf.jar  util.*  D:\\Java -i -q
    ,
jars=/opt/java/jre/lib/ext/mail.jar:/opt/java/jre/lib/ext/postgresql.jar
for jar in $(echo $jars | sed \'s/:/ /g\'); do 
    jar -tf $jar | grep Driver && echo $jar
done
对于Windows,将;替换为;。在\“ jars \”-变量和sed命令中。 sed是gnu-tools的一部分-它们有一个二进制的win32端口,其中包含grep,sed,sh.exe和更多有用的工具。 将驱动程序替换为%1以使其成为可参数化的脚本。     ,我会使用在线搜索工具,例如 http://jarsearch.com http://jarvana.com     ,由于您正在使用IntelliJ,因此您可以导航到相关的类(转到->类...),然后在项目视图中显示它(Alt-F1->项目视图)。     ,如果您已经有了罐子,建议您使用JD GUI。 只需打开罐子(将它们全部拖放到UI中),然后执行CTRL + SHIFT + T。输入类名,您将获得该类所在的所有jar的列表。 如果您知道类名而不是jar,请使用搜索Maven工具。 http://search.maven.org/ 对于商业客户,我通常使用Maven。我建立了一个内部链接存储库,然后从中使用搜索。 如果在Eclipse中设置了项目,请使用CTRL + SHIFT + T并输入类名 如果项目在IntellJ中,请使用CTRL + N并键入类名     

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。