Open In App

javap tool in Java with Examples

Improve
Improve
Like Article
Like
Save
Share
Report

javap tool


The javap tool is used to get the information of any class or interface. The javap command (also known as the Java Disassembler) disassembles one or more class files. Its output depends on the options used (“-c” or “-verbose” for byte code and byte code along with innards info, respectively). If no options are used, javap prints out the package, protected, and public fields and methods of the classes passed to it.
Syntax:

javap [option] [classname]

When no options are used:
Syntax:

javap class_name

Output:

When Options are used:

The description and implementation of options are given below:
Note: Some options prints very long output which can’t be shown completely. Please try in your System to view the complete output of options used.

  • -help or –help or -? :
    This option prints a help message for the javap command.
    Syntax:

    javap -help
    

    Output:

  • -version :
    This option prints Version information of java.
    Syntax:

    javap -version
    

    Output:

  • -v or -verbose :
    This option Prints additional information like stack size, number of locals and arguments for methods.
    Syntax:

    javap -v class_name
    

    Output:

  • -l :
    This option prints line number and local variable tables.
    Syntax:

    javap -l class_name
    

    Output:

  • -public :
    This option prints only public classes and members.
    Syntax:

    javap -public class_name
    

    Output:

  • -protected :
    This option prints protected/public classes and members.
    Syntax:

    javap -protected class_name
    

    Output:

  • -package :
    This option prints package/protected/public classes and members (default).
    Syntax:

    javap -package class_name
    

    Output:

  • -c :
    This option prints Disassembled code.
    Syntax:

    javap -c class_name
    

    Output:

  • -s :
    This option prints internal type signatures.
    Syntax:

    javap -s class_name
    

    Output:

  • -sysinfo :
    This option prints system info (path, size, date, MD5 hash) of class being processed.
    Syntax:

    javap -sysinfo class_name
    

    Output:

  • -constants :
    This option prints final constants of class.
    Syntax:

    javap -constants class_name
    

    Output:

  • References: https://docs.oracle.com/javase/8/docs/technotes/tools/windows/javap.html


    Last Updated : 10 May, 2019
    Like Article
    Save Article
    Previous
    Next
    Share your thoughts in the comments
Similar Reads