How to View a .class files? Use JAD

Hi,

We all are aware that, when a java code is compiled, we get a .class file. This is called compilation. However is there a reverse process for this?? Yes. Its decompilation. Below is how we can convert .class file to a java file. 

There is a simpler way of doing this. Using a GUI tool named “JD-GUI 0.2.8“. You can get it from here.

 So, how to go about? Here is how,

  1. Download a decompiler called JAD from here.
  2. Choose “Jad 1.5.8g for Windows 9x/NT/2000 on Intel platform ”  if you’re using windows.(Skip this step if you have used the second link to download the JAD)
  3. You’ll get a jad.exe file from the download. Paste it inside the folder where your .class file is.
  4. Double clikc the jad.exe file once. Doing so jad cmd will appear and disappear.
  5. Open your command promt and change its directory path to wher your .class file exits. For eg., if your .class file is in c:/freddie/java, fire a command in command promt like cd c:/freddie/java.
  6. Lets assume you want to view helloworld.class, then fire a command like jad helloworld.class.
  7. A JAD file would be generated now.
  8. Fire another command like jad -sjava helloworld.class.
  9. Your helloworld.java file would have been created now.

That’s it my friends. These are the simple 9 steps to convert a .class file to a .java file (otherwise called as decompilation).

Tip:

If you wish to decompile many .class files at a go, use the below command,

jad *.class

jad -sjava *.class

Note: There is a simpler way of doing this. Using a GUI tool named “JD-GUI 0.2.8“. You can get it from here.

I hope this is a valuable information for the needy 🙂

7 Responses

  1. Hi there a simple gui tool to convert Java file. No need to use cmd and all. You can download it in http://java.decompiler.free.fr/ Enjoy it simply superb.:)

  2. yup I tried it. Its very simple.

    Thanks 🙂

  3. Thank you!

  4. Also search for JadRetro tool – if used in conjunction with Jad (which hasn’t been maintained for ages), it make Jad produce better source in some cases (including for Java 1.5+ classes).

  5. Very Gud article……

  6. Very useful article….
    Thank you

  7. It is great help.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: