takes class-files as input and produces something similar to the original java-File. Of course this can't be perfect: There is no way to produce the comments or the names of local variables (except when compiled with -g) and there are often more ways to write the same thing. But it does its job quite well.

Quick Test

I have now an applet interface to the decompiler. Check it out.

How to get it

You can donwload the files in zip form. The sources contain only the java files, the classes contain only the class files.

I also have a tar.gz file containing only the RCS directories. This is the form I maintain the project, but you probably need unix and a few tools to use them.

There are also some snapshots that have new features like inner and anonymous classes.

Click here to browse the files online.

How to use it

I have some simple step by step pages. There are three possibilities:

Known bugs

There may be situations, where the code doesn't understand complex expressions. In this many ugly temporary variables are used, but the code should still be compileable. This does especially happen when you compile with `-O' flag and javac has inlined some methods.

Sometimes this program may exit with an Exception or produce incorrect code. Most time the code can't be compiled, so that it can be easily spotted. If you have one of these problems (except those that occur on some of the jode.test files, I would be very interested in a bug report (including the class file, if possible).

Sometimes it generates some GOTO expression and labels. This can't be compiled, but shouldn't happen any more with javac or jikes.

It doesn't handle inner and anonymous classes, yet. You can decompile them separately, though (use `+$' switch under jikes), but there is a bug in javac, so that a final variable is twice initialized. If you encounter this problem just remove the doubled line by hand.

New! The latest snapshot can handle inner and anonymous classes.

Why did I wrote it?

Someday I found guavad, a disassembler for java byte code (it does similar things like javap -c). I used it on a class file, and found that it was possible to reconstruct the original java code. First I did it by hand on some small routines, but I soon realized that it was a rather stupid task, and that I could write a perl script that does the same. At the end of the next day I had a working decompiler.

Now while it was working, it was not easy to use. You had to decompile the code first with a disassembler, cut the method, you wanted to decompile and then run the perl script on it. So I decided to get some information of the class files and do this all automatically. I decided to write it in java now, because it suited best.

Just for the records: the java code is now more than 50 times bigger than the original perl script and is still growing.

License

This code is under GNU GPL. That basically means, that you can copy or modify this code, as long as you put all your modification under the GPL again. Look here for the complete license.


http://www.informatik.uni-oldenburg.de/~delwi/jode/jode.html, last updated on 17-Jun-1999.