How To Debug Without Source Code

Posted By : Anil Kumar Maurya | 28-May-2018

Debugging gives much relief to developers. But sometimes we required debugging our own code as well as someone's else code which might not have the source code. The main goal of this blog is to be able to debug through class files without having the source code and being able to step through the code having the debugger always pointing the correct line of the code.

In order to debug class files without having the source code, we need to install JD-eclipse and its extension JD-eclipse realignment fragment. JD-Eclipse is a plugin for the Eclipse/STS(Spring Tool Suite) ide. It allows you to show all the Java sources while debugging, even if you do not have the source code. Bytecode Visualizer is another plugin that is also used as a java decompiler. The main advantage of using JD-eclipse realignment jar is that your debug pointer will always point to the correct line of code.

 

Installation:

JD-Eclipse:

  Go to the site http://jd.benow.ca/

  Click the download tab of JD-Eclipse and download the jd-eclipse-site-1.0.0-RC2.zip file

  For installation follow instructions as provided on the site

  Install and restart Eclipse.

realignment.jd.ide.eclipse_1.0.2.jar:

  Go to the site https://sourceforge.net/projects/realignmentjd/files/ and download the jar

  Copy the jar to the Eclipse's plugins folder and restart Eclipse.

 

Configurations:

Start the eclipse and Go to Windows -> Preferences -> General -> Editors -> File Associations

Select *.class in the File types section

Click add button in the Associated editors' section and select JD Class File viewer

Click the apply and close button

Repeat the same process for *.class without source file system.

 

Debugging the class file:

Go to your project in the project explorer, select the jar and open the class file with JD-Eclipse editor

Set the breakpoints in methods which you want to debug

Start the application in debug mode and start debugging.

About Author

Author Image
Anil Kumar Maurya

Anil is an experienced Lead with core knowledge of Java, Spring, and SQL. He has good working experience in banking, finance and trading domain.

Request for Proposal

Name is required

Comment is required

Sending message..