Thursday, March 16, 2006

Java Decompiler for Eclipse

I never really used Java decompilators, but recently I needed one. My peer developers used DJ Decompiler. So I got a copy installed on my laptop and there I was - happily decompiling everything I could possibly need to peek at. It's was cool for a while, but more and more I realized I needed something in Eclipse that would do the same job but better. Switching between Eclipse and DJ Decompiler became very tiring so I did a quick search for Java decompiler that integrates with Eclipse.

There is a Java decompiler that I found and which integrates with Eclipse (as a plug-in) very nicely. It basically decompiles the class butycode and shows you the source as java file (quite handy feature). Ladies and gentlemen let me introduce

JADCLIPSE
http://sourceforge.net/projects/jadclipse/

JadClipse is based on JAD decompiler (which is not included in JadClipse). You can obtain JAD from http://www.varaneckas.com/jad.

INSTALLATION

  • Unzip the jadnt158.zip file, no installation is necessary (to e.g. C:\jadnt158)
  • Add JAD_HOME to your env. variables (e.g. JAD_HOME=C:\jadnt158)
  • Add JAD_HOME to your PATH env. variable (e.g. %SystemRoot%\system32;...;C:\apache-ant-1.6.5\bin;%JAD_HOME%)
  • Unzip jadclipse_xx.zip into "plugins" subdirectory of the directory where you installed Eclipse.
  • Restart or start Eclipse.
  • Open any .class file which you don't have source for, it should be automatically decompiled.
  • Eclipse config - You can change path to Jad's executable (with the steps above simple "jad" will do) and temporary directory as needed (Follow Window -> Preferences -> Java -> JadClipse)

CONFIGURATION:

Most of the Jad's configuration options are available from:

Window -> Preferences -> Java -> JadClipse

Refer to Jad documentation for details on those options in case you need more information.

Happy decompiling!

:Dushan

9 comments:

Unknown said...

My Eclipse is not showing decompiled version of the classes. I gave the jad dir path properly and added the path in JAD_HOME and PATH variables, I can see the Decompile Menu Option in Eclipse, but still the classes are not decompiled fully, they just show the method signatures.
Can you please help?

Unknown said...

Hi Kalyani,

It's been nine months since I switched to IntelliJ IDEA, which we use at work. I love Eclipse, but have not used Eclipse and decompilation in particular since then.

As far as I remember, the configuration was not difficult at all. The important points were setting the JAD_HOME enviroment variable and the path to JAD executable in the configuration for JadClipse. Just make sure that you get them right. Everything should then work fine.

I hope this helps.

SleepyCat said...

I was having the same problem as kalyani using the Navigator view, and realized it works in the Package Explorer view just fine. Not sure why, but there ya go.

Daniel said...

Awesome project! I hate to go looking for source files and associate them with jar files etc etc. If things are not too complicated this is the perfect solution!

Anonymous said...

kalyani, I noticed an option in the jadclipse directives preferences that lets you switch off method bodies. Might be worth checking.

Anonymous said...

Thanks for the information. The said procedure is working fine for me ....

Allex said...

http://www.kpdus.com/jad.html
is outdated.

Then no one can install this eclipse plugin.

Anshul said...

THe location pointed for JAD exe seems to be nonexiting(GODADDY link not working) Is there any other place i can look for this Exe.?

Please help

Unknown said...

I have updated the link to JAD download. It should work now.


Creative Commons License This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License.