javap - Listing Public Variables and Methods

This section provides a tutorial example of how to list all public variables and methods of a class with 'javap' without any options.

In order to test the Java disassembler tool, I wrote this simple Java application file,

 * Copyright (c) 2005 All Rights Reserved.
public class Circle {
  public String uom = "Centimeter";
  private int x = 0;
  private int y = 0;
  private int r = 1;

  public void setRadius(int radius) {
    r = radius;
  public void setCenter(int centerX, int centerY) {
    x = centerX;
    y = centerY;
  public void printRadius() {
    System.out.println(r + " " + uom);
  public void printArea() {
    double area = getArea();
    System.out.println(area + " " + uom + "^2");
  private double getArea() {
    return 3.14159*r*r;

To test "javap", we need to compile this source code file into a bytecode class file, Circle.class:

herong> javac

herong> dir Circle.*

   1,393 Circle.class

Now we can see what "javap" will do for us on this bytecode class file:

herong> javap Circle

Compiled from ""
public class Circle extends java.lang.Object{
    public java.lang.String uom;
    public Circle();
    public void setRadius(int);
    public void setCenter(int, int);
    public void printRadius();
    public void printArea();

Very nice. By default, "javap" print a list of all public variables and methods.

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