如何在JAR文件中搜索字符串 [英] How to search for a string in JAR files

查看:1306
本文介绍了如何在JAR文件中搜索字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序是基于Java EE构建的。

My application is built on Java EE.

我在这个应用程序中有大约50个罐子。

I have approximately 50 jars in this application.

是否可以搜索特定关键字(实际上我想搜索关键字 BEGIN REQUEST )?

Is it possible to search for a particular keyword (actually I want to search for a keyword BEGIN REQUEST)?

推荐答案

你可以在linux上使用zipgrep,

You can use zipgrep on linux,

zipgrep "BEGIN REQUEST" file.jar

如果你必须在罐子里找到相同的东西,那么

If you have to find the same thing in number of jars, do

find libdir -name "*.jar" -exec zipgrep "BEGIN REQUEST" '{}' \;

其中libdir是包含所有jar的目录。该命令也将递归搜索子目录。

where libdir is a directory containing all jars. The command will recursively search sub directories too.

对于Windows,你可以下载cygwin并在其下安装zipgrep http://www.cygwin.com/

For windows, you can download cygwin and install zipgrep under it http://www.cygwin.com/

编辑1

要查看可以执行表达式的文件的名称,

To view the name of the file that the expression was found you could do,

find libdir | xargs -I {} sh -c'回显搜索{}; zipgrepBEGIN REQUEST{}'

这篇关于如何在JAR文件中搜索字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆