javap Command
The javap command is called the Java “disassembler” because it takes apart class files and tells you what’s inside them. You won’t use this command often, but using it to find out how a particular Java statement works is fun, sometimes. You can also use it to find out what methods are available for a class if you don’t have the source code that was used to create the class.
Here is the general format:
javap filename [options]
The following is typical of the information you get when you run the javap command:
C:\java\samples>javap HelloApp
Compiled from “HelloApp.java”
public class HelloApp extends java.lang.Object{
public HelloApp();
public static void main(java.lang.String[]);
}
As you can see, the javap command indicates that the HelloApp class was compiled from the HelloApp.java file and that it consists of a HelloApp public class and a main public method.
C:\java\samples>javap HelloApp -c
Compiled from «HelloApp.java»
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access