views:

10462

answers:

9

It hasn't been updated since 2006. Are there better alternatives?

Homepage: http://www.kpdus.com/jad.html

A: 

I've used Jad a number of times to decompile java source and it's excellent. It also has a very cool eclipse plugin which makes it even better.

lomaxx
+2  A: 

I recommend: DJ Java Decompiler. It's free to try and costs $19.99 to purchase.

I've also heard good things about Cavaj, but never used it personally. It's freeware, so definitely worth a try.

Ryan Guest
Cavaj is just a graphical frontend to Jad.
Asgeir S. Nilsen
So is DJ Java Decompiler.
Quinn Taylor
+3  A: 

Beware though, jad doesn't support Java 5 syntax (i.e., Generics) - but still handles .class files with generics pretty well.

So, if you want to decompile the .class file of the following example with jad

Map<String, Integer> map = new HashMap<String, Integer>();
map.put("one", Integer.valueOf(1));
System.out.println(1 == map.get("one"));

You'll end up with something like this:

Map map = new HashMap();
map.put("one", Integer.valueOf(1));
System.out.println(1 == ((Integer)map.get("one")).intValue());
Cem Catikkas
Actually there is no way any decompiler can determine if generics are used since generics in java are implemented with type erasure.
hhafez
Actually, from the example given, you have more than enough data to infer the Generic Type from the inputs to the HashMap and the cast. The class also contains versioning information, so for v.5 above it would seem to be a given that Generics should be used.
_ande_turner_
The example doesn't have enough data. The fact that `put()` is called with (`string`, `int`) doesn't mean that it's a map of `string` -> int` - it could just as well be a map of `Object -> Object`.
Pavel Minaev
Java erases generics at runtime. However at compile time, and in the bytecode you have information about generics so you could potentially extract generics information.
Alexandru Luchian
+6  A: 

Just a mention: "DJ Java Decompiler" is a windows-only GUI and taking Jad as its decompile engine.

Jad is 1.5.8g now and really awesome with its powerful commandline options and so many plugins on different Java-IDEs.

NullPointer
+19  A: 

What about Java Decompiler? Seems to be more up-to date

SztupY
Java Decompiler and it's JD-GUI is better than DJ Java Decompiler
Jader Dias
+9  A: 

Yes, DJ Java Decompiler is based on JAD as decompiling engine. But now it supports annotations and the new attributes in Java 1.5. It's much more powerful now.

Atanas
Yay! First to give you points!
Kieveli
A: 

Blockquote Actually, from the example given, you have more than enough data to infer the Generic Type from the inputs to the HashMap and the cast. The class also contains versioning information, so for v.5 above it would seem to be a given that Generics should be used. Blockquote

And what about custom generic classes? In what way they should be processed? IMHO, there are no feasible way to decompile java classes with generic syntax in common manner with present class metadata.

yury
A: 

There's also a tool called JadRetro (jadretro.sf.net) - a decompiler helper. To achieve better results (including for java 1.5+ classes) in decompilation, process the classes with JadRetro before decompiling them by Jad. (Of course, it won't make Jad produce source with generics.)

ivmai