Java Decompilers

Program-Transformation.Org: The Program Transformation Wiki

Java Bytecode Decompilers

Decompilers that read Java bytecode programs usually decompile to Java, since that is the language that the majority of such programs are written in. However, the source language could have been any of a large number of languages; see [other languages for the Java VM.

  • Jdec is a Java decompiler. It can be used to decompile the bytecodes present in a .class file to produce a Java source file which can be nearly correct or equivalent (due To different interpretations) to the original Java source. It also has a good UI. It is hosted on SourceForge. Currently Jdec is licenced under GPL. Visit the home site for any updates and current status.

  • JODE is an open source Java decompiler and obfuscator. Hosted on SourceForge under the GPL license. The core decompiler is under the LGPL, meaning that you can use it in a commercial decompiler. Written in Java. For tests see DecompilationJodeTest.

  • Dava is a research decompiler that recovers types well and has been tested against non-Java bytecode programs.

  • The Mocha decompiler for Java .class files. You can use crema to scramble symbolic information in the .class files.

  • JReversePro is an open source Java decompiler written in Java.

  • SourceAgain is one of the better known commercial Java decompilers.

  • DCompiler (also known as JADO) is yet another Sourceforge open source decompiler; this one is in very alpha status. It will not decompile even the simplest test programs, so no tests have been performed.

  • WingSoft have a decompiler called WingDis and an obfuscator called WingGuard (see their products page).

  • The JReveal decompiler (www.jreveal.org) seems to be the Jasmine decompiler (version 1.1 of Mocha), with a web based GUI front end. I could not get the decompiler to work for me (Jan 2003), but you may have better luck. There is a small online paper and some examples; it looks like a really handy tool.

Comparison of Java Bytecode Decompilers

Java Decompiler Articles

  • "Decompile Once, Run Anywhere": new.architect magazine have an archive of the classic article by Godfrey Nolan Decompile Once, Run Anywhere, which details how readily most Java programs can be decompiled. Godfrey has published a book titled "Decompiling Java".

Java Decompilation Books

  • "Decompiling Java": a book by Godfrey Nolan; ISBN 1590592654, APRESS August 2004. Amazon page. Note that some websites still refer to the old ISBN (0079137679); I believe that this version was never published. See also http://www.artima.com/chapters/book.jsp?num=62427. An early version of this book was available on the web. There is a whole chapter on defeating decompilers, one on decompiler design, and one on the implementation of a simple decompiler. There is little in the way of theory, e.g. structuring goto riddled code into readable Java loops and conditionals.

  • "Covert Java: Techniques for Decompiling, Patching, and Reverse Engineering", Alex Kalinovsky. Chapter 2 is on decompiling bytecode. Amazon page. ISBN 0672326388.

Java Decompiler Papers

Katsumata and Ohori published a paper describing a decompiler from bytecodes to a PCF-like language (simply typed functional language). For example, an iterative implementation of the factorial program becomes as shown below. The work is proof-directed and very theoretical, though they did build a decompiler (but not to Java, as shown below).
        fact(e0) =
          L12(e0, 1)
        L12(e0, e1) =
          if (1 < e0) then
            L12(e0 - 1, e1 * e0)
          else
            return e1
  • S. Katsumata and A. Ohori. Proof-directed De-compilation of Low-Level Code. In European Symposium on Programming, volume 2028 of Lecture Notes in Computer Science, pages 352-366. Springer-Verlag, 2001.
  • Alan Mycroft. Comparing Type-Based and Proof-Directed Decompilation. In Proceedings of the Working Conference on Reverse Engineering, pages 362-367, Stuttgart, Germany, 2001. IEEE CS-Press.
  • Programmer-friendly Decompiled Java, Nomair A. Naeem and Laurie Hendren. Technical report number SABLE-TR-2006-2, Sable Research Group, McGill University, 2006. This report is about making the Dava decompiler produce more readable output.

The Krakatoa Java decompiler appears to have a quite good structuring algorithm, according to the following paper, but the decompiler not publically available.

Decompiler front ends

Some decompilers are just GUI front-ends for a console (text) based decompiler. Some are listed in this table.
Front end (GUI) decompiler up Back end decompiler (engine)
jEdit's JavaInsight plugin JODE
JadClipse (Eclipse plugin) Jad
Frontend Plus Jad
DJ Java Decompiler Jad
Decafe Pro Jad
Cavaj Jad
BTJ (Back To Java) JODE

Java Decompiler Links

CategoryDecompilation