Search code examples
javacmd

java list all methods and classes in a jar file of specific package using cmd


I am trying to print all the public methods of classes of a package in a jar file, as of now I only have been able to print class names using:

jar -tf my.jar

But now I want to print all the methods of all classes of a package in a jar file how can i do this using command prompt.

I have seen javap command but its not working. I couldn't find an example of what I want.


Solution

  • jar tf will list the contents for you.

    javap will allow you to see more details of the classes (see the tools guide here).

    For instance if you have a class named mypkg.HelloWorld in a jar myjar.jar then run it like

    javap -classpath myjar.jar mypkg.HelloWorld