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!
When running in debug mode, click Edit Source Lookup after suspended from thread. At this point, we should be able to add the necessary project/jar which contains your source code. After I added my current project in this way, and it solved my problem. Thanks
I had the problem that my Eclipse was not debugging the source code of my project. I was getting a blank page with "Source code node found".
Please click the Attach source code button. Then delete the "default" folder then click add and go to your project location and attach. This worked for me
The symptoms perfectly describes the case when the found class doesn't have associated (or assigned) source.
But what if Eclipse still suggest that you attach source, even if I correctly set my classes and their sources:
This almost always means that Eclipse is finding the class from different place than you expect. Inspect your source lookup path to see where it might get the wrong class. Update the path accordingly to your findings.
Eclipse doesn't find anything at all, when breakpoint is hit:
This happens, when you are source lookup path doesn't contain the class, which is currently loaded in the runtime. Even if the class is in the workspace, it can be invisible to the launch configuration, because Eclipse follows the source lookup path strictly and attaches only the dependencies of the project, which is currently debugged.
An exception is the debugging bundles in PDE. In this case, because the runtime is composed from multiple projects, which doesn't have to declare dependencies on one another, Eclipse will automatically find the class in the workspace, even if it is not available in the source lookup path.
I cannot see the variables when I hit a breakpoint or it just opens the source, but doesn't select the breakpoint line:
This means that in the runtime, either the JVM or the classes themselves doesn't have the necessary debug information. Each time classes are compiled, debug information can be attached. To reduce the storage space of the classes, sometimes this information is omitted, which makes debugging such code a pain. Your only chance is to try and recompile with debug enabled.
Eclipse source viewer shows different lines than those that are actually executed:
It sometimes can show that empty space is executed as well. This means that your sources doesn't match your runtime version of the classes. Even if you think that this is not possible, it is, so make sure you setup the correct sources. Or your runtime match your latest changes, depending on what are you trying to do.
From http://www.coderanch.com/t/587493/vc/Debugging-Eclipse-Source
"When running in debug mode, right click on the running thread (in threads tab) and select Edit Source Lookup. At this point, you should be able to add the necessary project/jar which contains your source code."
I added my current project in this way, and it solved my problem
If your are trying to debug your maven java project, and eclipse is not able to find your source, try one of these.
Try maven->update and then debug
now try debugging
Well, here's what worked for me. I tried every possible solution on StackOverflow that there was. I tried changing my source location in the debug menu, I installed the m2e Eclipse plugin, I changed from embedded Maven, and I installed the run-jetty-run and nothing worked. Now, I will caveat that I was not trying to view an external person's source code, I just wanted to see my OWN code, but every time I "stepped in" to my methods that I wrote that were in MY project, I got the "Source now found" error.
After finally asking an expert, my issue was that the first thing Eclipse was doing was calling a ClassLoader, which you can see from the debug stack. All I had to do was F6 (step over) and then it took me back to my original call and then F5 (step in). And there was my code. Sigh...such a simple fix but an hour wasted.