"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();
   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);
   0:  aload_0
   1:  iload_1
   2:  putfield  #6; //Field r:I
   5:  return

public void setCenter(int, int);
   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();
   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

 About This Book

 Java Tools Terminology

 Java Tools Included in JDK

 javac - The Java Program Compiler

 java - The Java Program Launcher

 jar - The JAR File Tool

 jlink - The JRE Linker

 jmod - The JMOD File Tool

 jimage - The JIMAGE File Tool

 jpackage - Binary Package Builder

 javadoc - The Java Document Generator

 jdeps - The Java Class Dependency Analyzer

 jdeprscan - The Java Deprecated API Scanner

 jdb - The Java Debugger

 jcmd - The JVM Diagnostic Tool

 jconsole - Java Monitoring and Management Console

 jstat - JVM Statistics Monitoring Tool

 JVM Troubleshooting Tools

 jhsdb - The Java HotSpot Debugger

 jvisualvm (Java VisualVM) - JVM Visual Tool

 jmc - Java Mission Control

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

 jarsigner - JAR File Signer

 jshell - Java Language Shell

 jrunscript - Script Code Shell

 Miscellaneous Tools

 native2ascii - Native-to-ASCII Encoding Converter

 JAB (Java Access Bridge) for Windows

 Archived Tutorials


 Full Version in PDF/EPUB