/jd-gui-duo

A 2-in-1 JAVA decompiler based on JD-CORE v0 and v1

Primary LanguageJavaGNU General Public License v3.0GPL-3.0

CodeQL Maven Release Github Release

jd-gui-duo

A 2-in-1 JAVA decompiler based on JD-CORE v0 and v1 image

Initially a duo of decompilers were supported (JD-Core v0 & v1), but now other decompilers are supported with the transformer-api project. JD-Core v0 and v1 are 2 different decompilers rather than 2 different versions of the same one. They use a different algorithm :

  • JD-Core v0 uses byte code pattern matching like JAD, the 1st Java decompiler
  • JD-Core v1 uses an analytical algorithm like Fernflower, the 1st analytical decompiler

This project is built on top of original JD-GUI written by Emmanuel Dupuy.

Feature tour

Open Type

After opening a jar file, click 'Open Type' to decompile a class (tip: use $ to match the end of the class name)

image

Outline tree

Use the outline tree to select decompiled methods :

image

Maven central

In the Help -> Preferences menu, use search source code on Maven Central if you want to show the original source code, if it's available :

image

image

Search

Use the search button to do a search for methods, string constants,...

image

Decompile all classes

Use File -> Save All Sources to decompile all sources into a sources jar (choose a destination directory where you have rights)

image

Keyboard shortcuts

  • CTRL+F Find text
  • CTRL+L Goto line

image

Show byte code

Right-click on a method of the outline tree and select 'Show Byte Code' in the context menu.

image

image

To get a visual of the control flow graph that is used by JD-Core v1 for each of the decompilation steps, select one of the menus 'Show Control Flow Graph ...'. The graph is built by plantuml.

image

image

Method patching

Sometimes JD-Core v1 fails to decompile a method. In this case, method will be patched from JD-Core v0 if possible and the comment 'Patched from JD-Core v0' will appear :

image

Comparison

A modified version of JarComp is used to compare the jars and netbeans diff module for class comparison (see https://github.com/nbauma109/netbeans-visual-diff-standalone).

image

Select the 1st file to compare and then another file chooser will appear to select the 2nd file to compare :

image image

The differences in size and CRC checksums are shown :

image

Double-click on the row you want to compare :

image

Or alternatively, if the 2 jars are opened, you can open the type you want to compare :

image

If you select no, you will be asked select which file you want to open

image

Hyperlinks

The navigable links are shown as underlined portions of text. Single click navigates to definition (no CTRL click, no double click).

Select Decompiler

Choose another decompiler in the preferences window and the class will be decompiled with the newly selected decompiler as soon as you press OK.

image

Compiler

Compiler reports errors and warnings. Choose whether you want to report them in the preferences page.

image

image

Advanced class lookup

When this option is selected, the jars located in the same directory and the jmods (or rt.jar) of JAVA_HOME will be used by decompilers for better type resolution. Currently, the decompilers supporting this are CFR, JD-Core v1, Procyon. This option applies to the Eclipse AST parser too, to provide better hyperlinks. For optimal results, setup your JAVA_HOME to the same JDK that was used to build the jar you want to decompile (if any doubt, check the META-INF/MANIFEST.MF inside the jar). The running JRE of jd-gui-duo does not interfere. This option does not support jars in war.

Realign line numbers

This is a known option from the original JD-GUI that enables to align code for debugging if the debugging information is present in the class files. As of now, this is only supported by JD-Core v0 and v1. If the code is misaligned, the numbers will appear in red.

image

Remove unnecessary casts

This option uses the same feature as Eclipse to cleanup unnecessary casts.

Credits

Decompiler Author Link License
CFR Lee Benfield https://github.com/leibnitz27/cfr MIT
Procyon Mike Strobel https://github.com/mstrobel/procyon Apache v2
Fernflower Jetbrains https://github.com/JetBrains/intellij-community/tree/master/plugins/java-decompiler/engine Apache v2
Quiltflower QuiltMC https://github.com/QuiltMC/quiltflower Apache v2
JADX Skylot https://github.com/skylot/jadx Apache v2
JD-GUI Emmanuel Dupuy https://github.com/java-decompiler/jd-gui GPL v3