How to view the method members of a class within a jar file thru the command line
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.
精彩评论