jar文件查看
查看jar包内容
1 | unzip -q -c myarchive.jar META-INF/MANIFEST.MF |
-q
will suppress verbose output from the unzip program
-c
will extract to stdout
1 | unzip -q -c servlet-api.jar META-INF/MANIFEST.MF |
jar命令
在linux下如何查看一个jar文件中有哪些类呢?
jar tf test.jar
1 | META-INF/ |
grepjar
有些时候,我们需要查看一个jar文件中是否包含了某个方法,这个在linux下可以通过下面的命令来查询
grepjar methodName class.jar
1 | $ grepjar 'getStatus' servlet-api.jar |
参数:
||option || meaning ||
|-b | Print byte offset of match.|
|–|—————|
|-c | Print number of matches.|
|-i | Compare case-insensitively.|
|-n | Print line number of each match.|
|-s | Suppress error messages.|
|-w | Force PATTERN to match only whole words.|
|-e | PATTERN Use PATTERN as regular expression.|
|–help | Print help, then exit.|
|-V | |
|–version | Print version number, then exit.|
参考
How to read MANIFEST.MF file from JAR using Bash - Stack Overflow