%TOC% ---++ 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 [[http://c2.com/cgi/wiki?OtherLanguagesForTheJavaVm] [other languages for the Java VM]]. * [[http://jdec.sourceforge.net][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 [[http://sourceforge.net][SourceForge]]. Currently Jdec is licenced under GPL. Visit the [[http://jdec.sourceforge.net][home site]] for any updates and current status. * [[http://jode.sourceforge.net][JODE]] is an open source Java decompiler and obfuscator. Hosted on [[http://sourceforge.net][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. * [[http://kpdus.tripod.com/jad.html][Jad]] (Jad - the fast JAva Decompiler) is a decompiler that is free for non commercial use. Source code is not provided. Its decompilation engine is used in numerous graphical front ends, including [[http://www.reflectonus.pwp.blueyonder.co.uk/download.htm][FrontEnd Plus]], [[http://decafe.hypermart.net][Decafe Pro]], [[http://members.fortunecity.com/neshkov/dj.html][DJ Java Decompiler]], and [[http://sureshot.virtualave.net/cavaj][Cavaj]]. For tests see DecompilationJadTest. * [[DecompilationDava][Dava]] is a research decompiler that recovers types well and has been tested against non-Java bytecode programs. * The [[http://www.brouhaha.com/~eric/computers/mocha.html][Mocha]] decompiler for Java .class files. You can use crema to scramble symbolic information in the .class files. * [[http://www.srctec.com/decompiler.htm][SourceTec Java Decompiler]] (formerly the Jasmine Java Decompiler) is a patch to Mocha, a well known decompiler. It is now very old; it only works on Java 1.1 classfiles. For tests see DecompilationStTest. * JReversePro is an open source Java decompiler written in Java. * SourceAgain is one of the better known commercial Java decompilers. * [[http://mayon.actewagl.net.au/index.html][ClassCracker 3]] is another commercial Java decompiler. * Decaf was a decompiler for Java .class files written in Ada95. Decompilers to Ada95 and Smalltalked were planned. The page was at http://ourworld.compuserve.com/homepages/teleobjet/decaf.htm. You may be able to access an archived copy at [[http://www.archive.org][archive.org]]. * [[http://sourceforge.net/projects/dcompiler][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. * [[http://www.wingsoft.com][WingSoft]] have a decompiler called WingDis and an obfuscator called WingGuard (see their [[http://www.wingsoft.com/products.shtml][products]] page). * The JReveal decompiler ([[http://www.jreveal.org][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 * See [[Java Decompiler Tests]] ---++ Java Decompiler Articles * [[http://www.javaworld.com][Java World]] has an article [[http://www.javaworld.com/javaworld/jw-07-1997/jw-07-decompilers.html][Java decompilers compared]], where they compare DejaVu, Mocha, and WingDis. * [[http://www.andromeda.com/people/ddyer/java/decompiler-table.html][Java Decompilers and are they worth worrying about]]. This article also compares the above three decompilers. * "Decompile Once, Run Anywhere": [[http://www.newarchitectmag.com][new.architect magazine]] have an archive of the classic article by Godfrey Nolan [[http://www.newarchitectmag.com/documents/s=6410/new1013637873/index.html][Decompile Once, Run Anywhere]], which details how readily most Java programs can be decompiled. Godfrey has published a book titled "Decompiling Java". * "How to lock down your Java code": [[http://www-106.ibm.com/developerworks/java/library/j-obfus/?loc=crtheme][How to lock down your Java code (or open up someone else's)]]. Subtitle: _Your complete guide to the decompilation and obfuscation of Java code_, by Greg Travis, May 2001. From IBM Developerworks Java articles. #JavaDecompilerBooks ---++ Java Decompilation Books * "Decompiling Java": a book by Godfrey Nolan; ISBN 1590592654, APRESS August 2004. [[http://www.amazon.com/exec/obidos/tg/detail/-/1590592654/104-9575356-9027145?v=glance][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. [[http://www.amazon.com/exec/obidos/tg/detail/-/0672326388/ref=cm_custrec_gl_acc/104-9575356-9027145?v=glance&s=books][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. * [[http://www.sable.mcgill.ca/publications/techreports/#report2006-2][Programmer-friendly Decompiled Java]], Nomair A. Naeem and Laurie Hendren. Technical report number SABLE-TR-2006-2, [[http://www.sable.mcgill.ca][Sable Research Group]], [[http://www.mcgill.ca][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. * Todd A. Proebsting and Scott A. Watterson. [[http://research.microsoft.com/pubs/view.aspx?pubid=39][Krakatoa: Decompilation in Java (Does bytecode reveal source?)]]. In Conference on Object-Oriented Technologies and Systems (COOTS '97), pages 185-197. The USENIX Association, 1997. ---++ 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* | *Back end decompiler (engine)* | | Cavaj | Jad | | Decafe Pro | Jad | | DJ Java Decompiler | Jad | | Frontend Plus | Jad | | [[http://sourceforge.net/projects/jadclipse][JadClipse]] (Eclipse plugin) | Jad | | BTJ (Back To Java) | JODE | | jEdit's JavaInsight plugin | JODE | #JavaLinks ---++ Java Decompiler Links * See also the [[http://dmoz.org][dmoz open directory]] page [[http://dmoz.org/Computers/Programming/Languages/Java/Development_Tools/Translators/Decompilers_and_Disassemblers][Computers / Programming / Languages / Java / Development Tools / Translators / Decompilers and Disassemblers]]. * http://www.updated.com/search/?text=decompiler * [[http://flp.cs.tu-berlin.de/~tolk/vmlanguages.html][Programming Languages for the Java Virtual Machine]] is a page by Robert Tolksdorf for all sorts of languages that can be compiled to bytecodes, or translated to Java source. There are well over a hundred entries. * The Linux [[http://www.tldp.org/HOWTO/Java-Decompiler-HOWTO.html][Java-Decompiler-HOWTO]]. Some parts not to be taken too seriously (e.g. how to trust your decompiler). * http://java-decompiler.com has many links to Java decompilers, disassemblers, assemblers, obfuscators, etc. * [[http://www.preemptive.com/documentation/NewObfuscation.html][The New Obfuscation]] details developements in code security and Java obfuscation. * The Java Code Engineering pages seem to be gone forever. It had comprehensive details on Java disassemblers, decompilers, and more. The last copy of it that I am aware of is [[http://web.archive.org/web/20011121083507/http://www.meurrens.org/ip-Links/Java/CodeEngineering/decomp.html][here]] (from http://web.archive.org). CategoryDecompilation