When learning about the JVM recently, I came across the need to view the.class file. Here are two recommended methods:
Method 1: Use the javap command provided by the JDK
For example, a simple helloworld.java program:
public class HelloWorld {
public static void main(String[] args) {
System.out.println("hello world!"); }}Copy the code
Javac-parameters -d HelloWorld.
How do I read the binary bytecode file once I have it?
The first way is to use the JDK’s built-in decompiler: javap-verbose xxx.class:
Method 2: use notepad++ to view (HexEditor plug-in required)
Installation process:
- Download the HexEditor plug-inHexEditor(64-bit, 32-bit), extraction code:
imoc
- After downloading, place the package in the plugins directory under the notepad++ installation directory and copy the 64-bit HexEditor folder into the plugins directory:
Then make sure to close all notepad++ processes and reopen notepad++ :
Click in the red circleH
Icon to view binary encoding:
Done!