Can you recommend a good Java Decompiler paid or free to decompile Java
code?
I am having issues using JAD for with some class files that have nested
try-catch
blocks and its just not stable.
Which version of JAD are you using ? I find 1.5.8f works perfectly well for my
applications, but of course -- like any decompiler -- it can get confused,
especially when the compiler(s) it targets is(are) updated more often than it
is itself.
You could give SourceAgain a try:
http://www.ahpah.com/products.html
Commercial, but there is a web-based evaluation facility. It still talks about
1.3 so I doubt if it's under very active development, but FWIW it did do a
somewhat better job of converting the appended code (compiled with JDK1.5,
default options) than JAD 1.5.8f.
You might also look at Soot, which includes decompilation facilities:
http://www.sable.mcgill.ca/soot/
Just don't expect any decompiler to work perfectly...
-- chris
========== test code ===========
public class Test
{
public static void
main(String[] args)
{
int i = -1;
try
{
try
{
i = throw2();
System.out.println("got i: " + i);
}
catch (NullPointerException npe)
{
System.out.println("caught NPE: " + npe);
}
finally
{
System.out.println("finished inner");
i = throw1();
}
}
catch (IllegalStateException ise)
{
System.out.println("caught ISE: " + ise);
}
finally
{
System.out.println("done (i is" + i + ")");
}
}
private static int
throw1()
throws IllegalStateException
{
throw new IllegalStateException("throw1");
}
private static int
throw2()
throws NullPointerException
{
throw new NullPointerException("throw2");
}
}
========================