开发者

How to view the method members of a class within a jar file thru the command line

开发者 https://www.devze.com 2023-01-07 08:17 出处:网络
I am trying to look at the method members of a class within a jar file. Currently to list all the classes within a jar file, one can call this command:

I am trying to look at the method members of a class within a jar file. Currently to list all the classes within a jar file, one can call this command:

jar -tf myjar.jar but if i want to list the public methods within a particular class in this jar file, How 开发者_Python百科do i go about it. Thanks


One way would be via the javap JDK command.


I've quickly just hacked this together. Works in Bash/UNIX - I know you tagged this with Dos so probably wanted that, sorry:

export CLASSPATH=<JAR>
jar tvf <JAR> | awk '{print $8}' | grep class$ | sed 's/\.class$//' | xargs javap

Where <JAR> is the name of the jar you want to examine.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号