Integrate the Jad Decompiler Plug-in into Eclipse

on’t you hate it when you are debugging your code within Eclipse, and while stepping into a method call, a Class File Editor pops up exclaiming “Source Not Found”? Wouldn’t you rather see the Java source the next time that happens? By integrating a Java decompiler into your IDE, you can enable this functionality. Follow this complete step-by-step guide to integrate the Jad decompiler into Eclipse. Along the way, you’ll find out what makes Java decompilers such handy additions to the developer’s toolkit.

Installation
First, you need to download the necessary tools. Before anything else, make sure you have an installation of Eclipse. This article uses Eclipse 3.0.1. Note that in order to use Eclipse 3, you must use a J2SE of 1.4 or higher. This article uses J2SE 5.0 (formerly Tiger).

 
Figure 1. Eclipse JadClipse Settings

Now download the latest version of the Jad Java decompiler. This article uses version 1.5.8 for Windows.Unzip the zip file to your computer:

  1. Add your JAD_HOME directory to your PATH environment variable. For example, I unzipped my Jad download to C:jadnt158 and added it to PATH.
  2. To test whether you have configured correctly, open a new DOS shell. Type ‘jad’ at the prompt. You should see information about Jad and options for usage.

Next, download the latest version (beta 2.06) of the JadClipse plugin for Eclipse. Unzip the zip file to your computer. Copy the jadclipse folder (not jadclipse_b206) to your Eclipseplugins folder.

Finally, download the Spring Framework (Spring 1.1.2 was the latest version at the time of this article) and unzip the download to your computer.

 
Figure 2. Eclipse Workbench File Associations Settings

Configure JadClipse
Now configure the JadClipse plugin within Eclipse:

  1. Open Eclipse. At the top menu, click Window->Preferences->Java->JadClipse.
  2. Set Path to decompiler = %jadnt158_directory%jad.exe. Additionally, you can also set the output directory for decompiled files as well (see Figure 1). Click Apply.
  3. Now expand the Workbench node, and choose File Associations. In the top box named File Types, select *.class. In the bottom box named Associated Editors, select JadClipse Class File Viewer, and click Default (see Figure 2).

Creating a Project
Now you are ready to create a Java Project in Eclipse:

  1. Click File -> New -> Project. Choose Java Project and click Next.
  2. Under Name, type DevxDecompilerTutorial. Choose the location of your project, and create separate source and output folders. Click Next.
  3. You should now define your Java settings. Click the Libraries tab, and then click Add External JARs. Navigate to where you unzipped your Spring download, and add the spring.jar to your project. Click Finish.
 
Figure 3. XmlBeanFactory Class Decompiled

Search For and Then Decompile a Class
Now try to decompile a class within your project:

  1. Use the Eclipse shortcut CTRL + SHIFT + T, and type XMLBeanFactory. Press return.
  2. Your Eclipse editor will focus on a new file, XMLBeanFactory.class, which contains the Java source. At the top of the file, you will see comments the creators of the Jad decompiler made. At the bottom of your file, you will find a decompilation report (see Figure 3).

And that’s all there is to it. There are other java decompilers out there (Mocha, WingDis, and Déjà Vu come to mind), but they do not integrate into the IDE. What makes the Jad decompiler so powerful is you can integrate it into your development environment.

What do you stand to gain by integrating the decompiler into your IDE? The decompiler certainly is not a revolutionary tool that will change the way you code; but once you start to use it, you could soon easily find yourself relying on it throughout the working day. For example, when you search for classes as explained previously in this tutorial, your decompiler is there for you. During debugging, your decompiler will allow you to step into method calls of classes for which you don’t have the source. You might even prefer to look at the decompiled class first rather than the javadocs—why read the documentation of a jar or set of packages when you can look at the actual implementation?

DJ Java Decompiler
DJ Java Decompiler is a graphical version of the Jad decompiler tool. At the moment, a plug-in doesn’t exist to integrate into the Eclipse IDE, but then there doesn’t appear to be a need for one either. I use the DJ Java Decompiler on occasion, when it’s not practical to use the Eclipse Jad plug-in. Such cases might be:

  1. You want to decompile a library or a number of classes and plug them into your source directory to aid development.
  2. You are sure that you updated your build, but the change you made doesn’t appear to be in place. Decompile your build, and see if the change is there.

All in all, the decompiler can be a very handy development tool in your arsenal. I hope you’ll find it to be as useful in your development as I have.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

The Latest

microsoft careers

Top Careers at Microsoft

Microsoft has gained its position as one of the top companies in the world, and Microsoft careers are flourishing. This multinational company is efficiently developing popular software and computers with other consumer electronics. It is a dream come true for so many people to acquire a high paid, high-prestige job

your company's audio

4 Areas of Your Company Where Your Audio Really Matters

Your company probably relies on audio more than you realize. Whether you’re creating a spoken text message to a colleague or giving a speech, you want your audio to shine. Otherwise, you could cause avoidable friction points and potentially hurt your brand reputation. For example, let’s say you create a

chrome os developer mode

How to Turn on Chrome OS Developer Mode

Google’s Chrome OS is a popular operating system that is widely used on Chromebooks and other devices. While it is designed to be simple and user-friendly, there are times when users may want to access additional features and functionality. One way to do this is by turning on Chrome OS