Eric Bergman-Terrell's Blog

How to decompile Java code with JetBrains IntelliJ IDEA (2018.2.3, Windows 10)
October 5, 2018

Sometimes it's necessary to see the Java source code corresponding to a .jar file. Here's how:

In a command shell:

java -cp "C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2018.2.3\plugins\java-decompiler\lib\java-decompiler.jar" org.jetbrains.java.decompiler.main.decompiler.ConsoleDecompiler -hdc=0 -dgs=1 -rsy=1 -rbr=1 -lit=1 -nls=1 -mpm=60 {.class or .jar file to decompile} {folder into which to write results}

For example:

java -cp "C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2018.2.3\plugins\java-decompiler\lib\java-decompiler.jar" org.jetbrains.java.decompiler.main.decompiler.ConsoleDecompiler -hdc=0 -dgs=1 -rsy=1 -rbr=1 -lit=1 -nls=1 -mpm=60 "C:\Program Files\Vault 3\vault_win.jar" c:\temp\decomp

The above command will write a .java source file if the input is a .class file. If the input is a .jar file, it will write a .jar file containing sources. You can easily navigate through the .jar file by adding ".zip" to its file name, and then navigating it with the Windows File Explorer.

One never knows what one will find when decompiling 3rd party .jar files

Keywords: Java, JetBrains, IntelliJ, IDEA

Reader Comments

Comment on this Blog Post

Recent Posts

TitleDate
EBTCalc (Android) Version 1.53 is now availableMay 19, 2024
Vault 3 Security EnhancementsOctober 24, 2023
Vault 3 is now available for Apple OSX M2 Mac Computers!September 18, 2023
Vault (for Desktop) Version 0.77 ReleasedMarch 26, 2023
EBTCalc (Android) Version 1.44 is now availableOctober 12, 2021
Vault (Desktop) Version 0.72 ReleasedOctober 6, 2021
EBT Compass is Now Available for Android DevicesJune 2, 2021