Jonathan Jonathan - 1 year ago 126
Java Question

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!

Answer Source

Eclipse debugging works with the class actually loaded by the program.

The symptoms you describe sounds like the class in question was not found in the project, but in a distribution jar without debug info found before the project you are working with.

This can happen for several reasons but have a look at the location where the classes showing this behaviour is found (look in the navigation pane to identify it). You will most likely need to change the build path of the project to avoid using this jar and have the JVM use the project instead.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download