How to get method signatures from a jar file?

MCS picture MCS · Jun 10, 2009 · Viewed 39.3k times · Source

I have a third-party jar file that comes with the javadocs for only part of the API. Is there a way to reverse engineer the jar file to obtain a complete listing of classes and methods?

Answer

Tom Hawtin - tackline picture Tom Hawtin - tackline · Jun 10, 2009

jar tf will list the contents for you. javap will allow you to see more details of the classes (see the tools guide).

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

However, are you sure you want to be using these unpublished APIs? It's usually a really bad idea.