Java Decompiler is a nice decompiler for Java. Lets try it! Here is my source code:
package se.lesc.blog;
/** This is class that shows how decompiled classes may look like */
public class DecompileExample {
public static void main(String[] args) {
String output = "";
//Lets print out 10 Hello world
for (int i = 0; i < 10; i++) {
output += "Hello World\n";
}
System.out.println(output);
}
}
When opening DecompileExample.class in Java Decompiler it looks like this;As you can see it is very easy to browse related class files in the navigation pane to the right.When saving the source code to a file it will look like this:
/* */ package se.lesc.blog;
/* */
/* */ import java.io.PrintStream;
/* */
/* */ public class DecompileExample
/* */ {
/* */ public static void main(String[] args)
/* */ {
/* 8 */ String output = "";
/* */
/* 10 */ for (int i = 0; i < 10; i++) {
/* 11 */ output = output + "Hello World\n";
/* */ }
/* 13 */ System.out.println(output);
/* */ }
/* */ }
Things to note:
- The original line numbers has been added as a comment.
- Every original comment has been removed (it is removed in the compilation phase).
- The string operator
+=has been replaced by= output +.

Also you can try AndroChef Java Decompiler - http://www.neshkov.com/ac_decompiler.html
ReplyDelete