Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse java debugging: source not found

While debugging a java app in eclipse I receive a "Source not found" error in two cases:

  • Stepping in to a file in a different project which is already imported
  • Stepping in to a file in an installed maven repository

The files are there, but eclipse won't step into them, instead it shows a button to "attach source"

I tried attaching (which opened a dialog to define a variable?!) and eclipse did jump to the file, but the debugger could not inspect any variables there. Also manually attaching the source for each dependency isn't practical, as in my case there are thousands of dependency files.

I'm new to eclipse\java so an explanation of why this is happening + how to resolve this would help a lot!

like image 233
Jonathan Livni Avatar asked May 30 '11 09:05

Jonathan Livni


People also ask

How do I fix debugging 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. Either actions mentioned above creates a new Debug Launch Configuration and uses it to start the Java application.

How do I run a debug test in Eclipse?

With the test class open in the Eclipse editor, simply right click in the editor view and select Debug As > TestNG Test. Eclipse will stop at any breakpoints you set just like it would with any other local debug process.


1 Answers

Just 3 steps to configuration Eclipse IDE:

Note: After updating the Source Lookup paths, you'll have to stop and restart your debug session. Otherwise, the file with the missing source will continue to show "missing source".

Edit Source Lookup Select the Edit Source Lookup... command [ Edit Source Lookup ] to open the Source Path Dialog, which allows you to make changes to the source lookup path of the selected debug target.

enter image description here

enter image description here

enter image description here

IMPORTANT Restart Eclipse after this last step.

like image 188
Douglas Frari Avatar answered Oct 05 '22 13:10

Douglas Frari