Why convert CLASS to JAVA?
A .class file stores compiled bytecode, not source code. Decompiling is useful when the original .java files are lost or unavailable, for auditing third-party code, or for understanding what a compiled class does. A decompiler reverse-engineers an approximation of the original Java source.
How to convert CLASS to JAVA
JD-GUI OPEN-SOURCE
Drag the .class file onto the JD-GUI window and the reconstructed source appears immediately. Use File > Save All Sources to export .java files.
CFR OPEN-SOURCE
Run java -jar cfr.jar MyClass.class --outputdir ./out and the decompiled .java file appears in the output folder.
IntelliJ IDEA Community FREE
Open or drag the .class file into the editor; IntelliJ automatically decompiles it using the built-in Fernflower engine and displays the source.
About these formats
A CLASS file is compiled Java bytecode - the output javac produces from a .java source file. To run it you need Java (a JDK) installed, then use the command "java MyClass". To read what the…
Open .CLASS details →A JAVA file is human-readable source code written in the Java programming language. Open it in any text editor or a Java IDE such as IntelliJ IDEA or VS Code. To run it, install a JDK, then…
Open .JAVA details →Quality & what to watch
- Comments in the original source are stripped by the compiler and cannot be recovered from bytecode.
- Original local variable names are usually replaced with generated names such as
var1,var2unless the class was compiled with debug info (javac -g). - Obfuscated classes (processed with ProGuard or R8) decompile into barely readable code - the decompiler works, but output reflects obfuscated names.
Frequently asked questions
Is decompiled Java source recompilable?
How do I know which Java version compiled the class?
.class header indicates the Java release - for example, 52 = Java 8, 61 = Java 17, 65 = Java 21.What if I only need to inspect the bytecode, not recover Java source?
javap -c -p MyClass (bundled with the JDK) disassembles the bytecode to mnemonics without a separate download.