It hasn't been updated since 2006. Are there better alternatives?
Homepage: http://www.kpdus.com/jad.html
It hasn't been updated since 2006. Are there better alternatives?
Homepage: http://www.kpdus.com/jad.html
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.
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.
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());
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.
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.
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.
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.)