Afamee
Afamee

Reputation: 5320

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 do i go about it. Thanks

Upvotes: 2

Views: 3706

Answers (2)

McDowell
McDowell

Reputation: 108899

One way would be via the javap JDK command.

Upvotes: 1

Noel M
Noel M

Reputation: 16116

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.

Upvotes: 1

Related Questions