The javap tool is a Java profiler tool available in bin folder of the installed JDK (C:\Program Files\Java\jdk1.8.0_60\bin). The javap command displays information about the fields, constructors, methods, parameters, blocks, and thrown exceptions present in a class file.
Syntax:
javap
Note: If you did not use any options then the javap tool will not show the private members of the class.
Example:
D:\> javap java.lang.Object
Or
D:\topperskills\examples> javap MyClass
Note: The javap tool uses the compiled .class file and not the .java source file, therefore you must compile a source file to use javap tool.
Option | Description |
---|---|
-help | Displays a help message for the javap tool. |
-public | Shows only the public classes and members. |
-protected | Shows only the public and protected classes and members. |
-private | Shows all classes and members. |
-package | Shows the package, protected, and public classes and members. This is the default option of the javap tool. |
-classpath | Specifies the class path that javap should use to locate the class file to disassemble. |
-sysinfo | shows system info (path, size, date, MD5 hash) |
-verbose | Prints stack size, number of locals and args for methods |
-version | Prints out the javap version string |
-c | disassembles the code |
-l | prints line number and local variable |