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!
You might have source code of a dependency accessible to Eclipse. But Eclipse does not know for source code for code that is dynamically loaded. E.g. through Maven.
In case of Maven, I recommend that you use run-jetty-run plugin:
http://code.google.com/p/run-jetty-run/
As a workaround you can also connect to a running JVM with the debugger and you will see the code. Alternatively you can use Dynamic Source Lookup plugin for Eclipse from here:
https://github.com/ifedorenko/com.ifedorenko.m2e.sourcelookup
Unfortunately it didn't helped me as it has issues with Windows paths with spaces.
I have filled an enhancement request on Eclipse Bugzilla and if you agree this issue "Source not found" should vanish forever, please vote for it here:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=384065
Thanks!
Sasa
If you are on eclipse or STS please install and Use GC(GrepCode Plugin) ,some time you don't need to attach the source .zip file into your project path so GrepCode works fine for you.
Remove the existing Debug Configuration and create a new one. That should resolve the problem.
I've had a related issue in connection with Glassfish server debugging in Eclipse. This was brought about by loading the source code from a different repository (changing from SVN to GitHub). In the process, the wrong compiled classes were used by the Glassfish server and hence, the source and run time would be out of sync with break points appearing on empty lines.
To solve this, rename or delete the top folder of the classes directory and Glassfish will recreate the whole class directory tree including updating the class files with the correctly compiled version.
The classes directory is located in: /workspace/glassfish3122eclipsedefaultdomain/eclipseApps/< your Web Application>/WEB-INF/classes
this worked for me
right click on project -> Properties -> Deployment Assembly -> add your jar
I was facing the same issue,I followed the bellow steps.
Window => Preferences => Java => Installed JREs,
You see in the above screen
Jre1.8.0_12
is selected.select the JRE you are using and click Edit. Now You should see the bellow screen.
Click on the directory, browse for Jdk, It should look like bellow screen.
click ok, and its done