How do I decompile Java classes in Eclipse?
Author: Deron Eriksson
Description: This Java tutorial describes how to decompile Java classes in Eclipse using JAD.
Tutorial created using: Windows XP || JDK 1.5.0_09 || Eclipse Web Tools Platform 1.5.1
(Continued from page 1)
Now, let's set up EclipseSW to automatically decompile classes for us. Download the JadClipse Eclipse plug-in from http://jadclipse.sourceforge.net/. Put it in your plugins directory and restart Eclipse. Below, you can see it in my 'externalized' plugins directory.
If JadClipse is installed correctly, in Window → Preferences, you should now have a JavaSW → JadClipse entry. If you added your jad directory to your system path as shown above, your 'Path to compiler' entry should be fine. If you didn't, you'll need to modify the path to JAD so that JadClipse can find it. I modified my temporary files directory from the default to go to C:\temp\.jadclipse, but this is not necessary.
In Window → Preferences, you should check your General → Editors → File Associations to be sure that the JadClipse Class File Viewer is set as the editor for your *.class files.
Let's try JadClipse out. As an example, I downloaded the Jakarta CommonsSW Lang library from http://commons.apache.org/downloads/download_lang.cgi. Although this library does have source code available, let's not use it so that we can see JadClipse in action. I created a /lib directory in my project, put the commons-lang jarW file in the directory, and then added the jar file to the project's classpathW (this can be set by right-clicking the project name, going to Properties, and adding the jar file to the Java Build Path).
I'll use Common Lang's StringUtils class within my Test class. Now that I've done this, I can select the StringUtils class and hit F3 to jump to the StringUtils class.
This brings up the JadClipse Class File Viewer. As you can see, JAD decompiles the StringUtils.class file and displays the results. Java class decompilation with a click!
(Continued on page 3)