Byte codes generated by javac compiler can again be converted into java source. For this we need a decompiler tool. Decompilers are the utilities that generate the source code from input java class file.
A Decompiler knows about the structure of a Java class and parse it to generated Java source code.
Java decompilers will not give the exact Java source file from which class was generated and executed by Java Virtual Machine. But most of the structure will be maintained.
JAD: Java Decompiler
A lot of Decompilers are available in the market to decompile a class file. We will use one of the free decomipler called JAD.
You can download JAD compiler from here. Update: JAD’s site is down hence you can download it from this link.
I have used a simple Hello World java class to demonstrate JAD decompiler. Following is the code of HelloWorld.java file.
String fooBar = "Hello World from Java.";
Use following output when we use command line utility JAD to decompile our class file.