Java Tools Tutorials - Herong's Tutorial Examples - v6.24, by Herong Yang
"javap -c -private" - Disassembling Java Bytecode Class
This section provides a tutorial example of how to disassemble Java bytecodes with 'javap -c -private' command. The disassembled codes are JVM execution instructions.
Actually, the main function of "javap" is to disassemble Java bytecodes with the "-c" option. The disassembled codes are execution instructions of JVM (Java Virtual Machine).
Now, let's try "javap -c -private" with the bytecode compiled from Circle.java source code.
herong> javap -c -private Circle
Compiled from "Circle.java"
public class Circle extends java.lang.Object{
public java.lang.String uom;
private int x;
private int y;
private int r;
public Circle();
Code:
0: aload_0
1: invokespecial #1; //Method java/lang/Object."<init>":()V
4: aload_0
5: ldc #2; //String Centimeter
7: putfield #3; //Field uom:Ljava/lang/String;
10: aload_0
11: iconst_0
12: putfield #4; //Field x:I
15: aload_0
16: iconst_0
17: putfield #5; //Field y:I
20: aload_0
21: iconst_1
22: putfield #6; //Field r:I
25: return
public void setRadius(int);
Code:
0: aload_0
1: iload_1
2: putfield #6; //Field r:I
5: return
public void setCenter(int, int);
Code:
0: aload_0
1: iload_1
2: putfield #4; //Field x:I
5: aload_0
6: iload_2
7: putfield #5; //Field y:I
10: return
...
private double getArea();
Code:
0: ldc2_w #18; //double 3.14159d
3: aload_0
4: getfield #6; //Field r:I
7: i2d
8: dmul
9: aload_0
10: getfield #6; //Field r:I
13: i2d
14: dmul
15: dreturn
}
Note that:
Table of Contents
javac - The Java Program Compiler
java - The Java Program Launcher
jpackage - Binary Package Builder
javadoc - The Java Document Generator
jdeps - The Java Class Dependency Analyzer
jdeprscan - The Java Deprecated API Scanner
jcmd - The JVM Diagnostic Tool
jconsole - Java Monitoring and Management Console
jstat - JVM Statistics Monitoring Tool
jhsdb - The Java HotSpot Debugger
jvisualvm (Java VisualVM) - JVM Visual Tool
►javap - The Java Class File Disassembler
javap - Java Disassembler Command and Options
javap - Listing Public Variables and Methods
"javap -private" - Listing Private Variables and Methods
►"javap -c -private" - Disassembling Java Bytecode Class
Looking Up Method Signature with javap Command
keytool - Public Key Certificate Tool
jrunscript - Script Code Shell
native2ascii - Native-to-ASCII Encoding Converter