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»
Get Java For Dummies Quick Reference now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.