Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to debug compiled Java code in Eclipse [closed]

I wonder if there are any solutions for Eclipse IDE to debug Java code for which I have no source, i.e. to debug dynamically decompiled code, step through it, etc.? I tried to use JD-Eclipse, JadClipse, and these plug-ins work great if I want to look at some class files, but as I debug, I get "Source not found." - how can I "attach" these plug-ins to "provide" source?

My environment:

  • Eclipse 3.5
  • Windows XP (but I look for a cross platform solution, if possible)

Thank you.

like image 500
NSPKUWCExi2pr8wVoGNk Avatar asked Dec 15 '09 06:12

NSPKUWCExi2pr8wVoGNk


People also ask

How do you debug a program while it is still in use Java?

Most debuggers allow you to debug a program in one of 2 ways: You run the program from within the debugger. You attach debugger to an already running program.

Can we go back while debugging in Eclipse?

Yes, Eclipse CDT has support of historical debugger feature. Open Debug Configuration -> Debugger -> Enable Reverse Debugging at startup . Than you can press shift+F5 or shift+F6 for step back like F5 or F6 for step forward.

How do I run Java in debug mode in Eclipse?

A Java program can be debugged simply by right clicking on the Java editor class file from Package explorer. Select Debug As → Java Application or use the shortcut Alt + Shift + D, J instead.

How do I close debug view in Eclipse?

Right Click the project and Open Properties. Then Select Run/Debug Setting from there you will find all the launch Configured. Delete all the launch and Run the application.


2 Answers

I have the same problem. Today, no decompilers are efficent to debug compiled Java code. I'm working on JD-Eclipse. In the next 3 to 6 months, the layout of JD-Eclipse should be really improved. We will start to debug classes without sources and solve some intractable problems.

like image 198
Emmanuel Dupuy Avatar answered Sep 24 '22 01:09

Emmanuel Dupuy


I have good experience with Jadclipse - http://jadclipse.sourceforge.net/wiki/index.php/Main_Page - there is an update site at http://jadclipse.sf.net/update

For best results, use jad and configure it to list line numbers as comments which will enable the output where the code is on the correct line. This is best for debugging sessions.

Then set it to be the default view for classes. See the documentation for details. This works well for me.

like image 41
Thorbjørn Ravn Andersen Avatar answered Sep 27 '22 01:09

Thorbjørn Ravn Andersen