Eclipse – Debug java program without source code – jd-eclipse and realignment

Hi all,

I have been trying to debug java programs without having the source code (having only the jar files with .class). The main goal of this task was to be able to debug through .class files and being able to step through the code having the debugger always showing the correct line of the code.

Finally I succeeded with the help of a combination of jd-eclipse and its extension jd-eclipse realignment fragment.

The process for installing this is quite simple:

  1. Install JD-Eclipse following the steps provided in the JD-Eclipse site (the process is quite simple)
  2. Restart Eclipse
  3. Download Realignment realignment.jd.ide.eclipse_1.0.2.jar –
  4. Copy the file to the <Eclipse installation folder>\dropins
  5. Restart Eclipse
  6. Go to Windows -> Preferences
  7. Navigate to General -> Editors -> File Associations
  8. Select *.class in the File types section, select Realignment for JD Class File Editor in the Associated editors section and click the Default button.
  9. Press OK and start debugging!

The association should look like this:

Let me know if you face any problems with this procedure and I’ll try to help!

Note: I have empirically found out that in order for the source to be found, if the jar files being used in the project belong to a different project, they need to be added to the build path as “Add External JARs…“.Otherwise if “Add Jar”, is used you will get this message when stepping into a class from that JAR:


14 responses to “Eclipse – Debug java program without source code – jd-eclipse and realignment

  1. Thanks for this post! Life got better when debugging works with aligned lines!

    The plugins folder should not be messed with. Since P2, the official way is to put the plugin in the dropins folder.

  2. Hi –

    Thanks for the great post. I was able to install your decomipler and it works great, aligns the code exactly as the source and I am good there.

    However when I debug my program I still see the source not found issue. Now this is related to the eclipse debugger than your decompiler, however any additional inputs would be helpful. I am trying to debug a web-application where all the jar files reside in the web-inf/lib folder. I tried using various ways to add the .jar files (including external jar) into eclipse/tomcat source as well as the classpath, no luck yet. Any help would be appreciated.


    • Hi, did you try using the button “Edit source lookup” when the “Source not found” message appears? You may add the jar files there, after adding them to the project classpath.

  3. Hi!

    I have copied to the eclipse/dropins but the editor does’t appear in associated editor!

    I use Eclipse Java EE ide based on Eclipse 3.7.

    What can I do?


    • Hi, sorry for the late answer.. which associated editors do you see for the *.class files?
      Please see if you can see at least “Class file viewer” and “Class file editor”. If you don’t see the latter, then jd-eclipse wasn’t installed correctly.

  4. Hi ,

    I followed all the steps to install JD-Eclipse and realignment fragment . And even made the File association settings as per the instruction given above . I am getting the line numbers of the decompiled code but unable to debug or even reach to that decompiled line of code while debugging ( i have even set the break points ) . But in vain . Any help will be appreciated . Thanks .

    • Hi Anjum, in order to troubleshoot, you can start debugging in a class you have the source and step into a method of a method you don’t have the code. If you see a Source not found window, you can use the suggestion I left at the end of my post (using “Add External JARs…“).

  5. problem I am facing with jad de-compiler is that it’s not able to de compile the java 6 code properly. so I am unable to see exactly whats happening. Please guide me with this.

  6. Hi,i have a problem.
    now i only a .apk i don’t konw how to debug it.I use dex2jar to get the .jar but i don’t konw how to do…

Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s