Site icon TestingDocs.com

The Javap Utility – Java Class File Disassembler

Overview

The javap is a utility program that provides us with information on Java .class files. It is a Java class file disassembler that dissembles Java bytecode. We can use the utility to disassemble one or more .class files.

Java source code is compiled into machine-independent bytecode .class files. The javac Java compiler compiles *.java source code to *.class bytecode files. Java Bytecode is interpreted by machine-specific JVMs.

javap Utility

The javap tool is used to verify the profile of the class or interface. By default, the internal details of the class or interface will be displayed on the console window. The tool is usually found under the bin directory of the JDK home directory.

On Windows

%JAVA_HOME%\bin

To know all the supported flags:

\> javap –help

The -c command-line switch will disassemble the Java Bytecode.

Tool Usage

The general syntax of the tool is shown below:

\> javap <fully_qualified_name_of_the_class/interface>

\> javap Hello.class

If no command line switches are used, javap prints out the variables and methods of the class file.

To disassemble the bytecode, use the -c command line switch:

\>javap -c Hello.class

Example

For example, to know the internal details of the System class, we can use the following command:

\> javap java.lang.System

Java Tutorials

Java Tutorial on this website:

https://www.testingdocs.com/java-tutorial/

For more information on Java, visit the official website :

https://www.oracle.com/java/

Exit mobile version