Overview:
javap is a Java class file decomposer that can decompile or view the bytecode generated by the Java compiler to analyze the execution logic inside the code.
Syntax:
Compile the java file into a class file: javac Test.java (Test.java is the name of the java file) and generate the corresponding .class file Test.class
Execute javap operation: javap command line class file name (without .class suffix)
For example: javap -c Test
Command line
- help output javap help information.
-l Output lines and local variable tables.
-b ensures backward compatibility with JDK 1.1 javap.
-public displays only public classes and members.
-protected displays only protected and public classes and members.
-package displays only package, protected and public classes and members. This is the default setting.
-private displays all classes and members.
-J[flag] directly passes the flag to the runtime system.
-s prints the internal type signature.
-c outputs the unparsed code of each method in the class, that is, the instructions that make up the Java bytecode.
-verbose outputs the stack size, the number of locals and args of each method, and the compiled version of the class file
-classpath [path] specifies the path used by javap to find classes. If this option is set, it overrides the default value or the CLASSPATH environment variable. Directories are separated by colons.
- bootclasspath [path] specifies the path used to load the boot class. By default, the bootstrap classes are the classes that implement the core Java platform and are located in jrelibt.jar and jrelibi18n.jar.
-extdirs[dirs] overrides the location of search for installation extensions