# javap - Java class file disassembler

Disassembles class files.

## SYNOPSIS

javap [ options ] class. . .

## DESCRIPTION

The javap command disassembles a class file. Its output depends on the options used. If no options are used, javap prints out the public fields and methods of the classes passed to it. javap prints its output to stdout. For example, compile the following class declaration:

        class C {
            static int a = 1;
            static int b = 2;
            static {
    	    System.out.println(a);
            }
            static {
    	    a++;
    	    b = 7;
    	    System.out.println(a);
    	    System.out.println(b);
            }
            static {
    	    System.out.println(b);
            }
            public static void main(String args[]) {
    	    C c = new C();
            }
        }

When the resulting class C is passed to javap using no options, output like the following results:

        Compiled from C:\users\lindholm\C.java
        private class C extends java/lang/Object {
            static int a;
            static int b;
            public static void main(java/lang/String []);
            public C();
            static void ();
        }

## OPTIONS

-p
  Prints out the private and protected methods and fields of the class in addition to the public ones.
-c
  Prints out disassembled code, i.e., the instructions that comprise the JAVA bytecodes, for each of the methods in the class. For example, passing class C to javap using the -c flag results in output like the following:

          Compiled from C:\users\lindholm/C.java
          private class C extends java/lang/Object {
              static int a;
              static int b;
              public static void main(java/lang/String []);
              public C();
              static void ();

          Method void main(java/lang/String [])
             0 new #4
             3 invokenonvirtual #9 ()V>
             6 return

          Method C()
             0 aload_0 0
             1 invokenonvirtual #10 ()V>
             4 return

          Method void ()
             0 iconst_1
             1 putstatic #7
             4 getstatic #6
             7 getstatic #7
            10 invokevirtual #8
            13 getstatic #7
            16 iconst_1
            17 iadd
            18 putstatic #7
            21 bipush 7
            23 putstatic #5
            26 getstatic #6
            29 getstatic #7
            32 invokevirtual #8
            35 getstatic #6
            38 getstatic #5
            41 invokevirtual #8
            44 iconst_2
            45 putstatic #5
            48 getstatic #6
            51 getstatic #5
            54 invokevirtual #8
            57 return

          }

-classpath path
  Specifies the path javap uses to look up classes. Overrides the default or the CLASSPATH environment variable if it is set. Directories are separated by semicolons. Thus the general format for path is:

          .;<your_path>

  For example:

          .;C:\users\lindholm\classes;D:\java\classes

## ENVIRONMENT VARIABLES

CLASSPATH
  Used to provide the system a path to user-defined classes. Directories are separated by semicolons, for example,

          .;C:\users\lindholm\classes;D:\java\classes

## SEE ALSO

java, javac, javaprof, javah, javadoc The JAVA Language Specification, The JAVA Virtual Machine Specification