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
How to decompile Java code with JetBrains IntelliJ IDEA (2018.2.3, Windows 10)October 5, 2018
Java Programming Tip: SWT Photo Frame ProgramOctober 31, 2016
Vault 3 (Desktop) Version 1.63 ReleasedSeptember 9, 2016
"Compliance with Court Orders Act of 2016"April 9, 2016
Disable "Visual Voicemail" on Android / T-MobileJanuary 17, 2016
IPv6 HumorDecember 10, 2015
Java Programming Tip: Specify the JVM time zoneDecember 7, 2015