Accepted answer

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.

edit: note that as of 2018 it is common to use a build framework like maven, where the build path is managed by the m2e plugin so this problem should be very less frequent than when the question was asked. if you use maven and m2e, make sure to enable preferences / maven / "download artifact sources" or right-click the project, maven / "download sources".


in my case problem was resolved by clicking remove all breakpoints


if your are trying to debug your maven java project, and eclipse is not able to find your source, try one of these.

  1. try adding these lines in the pom.xml

try maven->update and then debug

  1. go to the root directory of the project;

mvn eclipse:eclipse

now try debugging


in eclipse photon try to turn off "window->preferences->java->debug->use advanced source lookup"

edit: there is a related bug in this version of eclipse which leads to a "source not found" message while debugging java applications. see bug report for more details


i had the very same problem. in my case, i've disabled window-preferences-java-debug [suspend execution on uncaught exceptions]. then, the console showed me the correct error: my mysql user hadn't privileges to access the database. according to this topic.


info: this is a possible solution, when you use maven (pom.xml) with couple of projects.

if you are working with maven, make sure what version you are taking inside the according pom.xml (e. g. 1.0.1-snapshot ). it might be possible that your code is up-to-date, but your pom.xml dependencies are still taking the old jar's/snapshots (with the old code).

finding the problem:

  • try to debug the according file.
  • therefore, set a breakpoint in the relevant code area.
  • when "source not found" appears, make sure to bind in the right project (where the .java file can be found).
  • the compile .class file opens up in the ide editor.
  • click "link with editor" to find the according jar/snapshot.
  • now make sure that this jar is the most recent one. possibly there is a newer one. in that case, write the most recent version number in the pom.xml.
  • then do a maven update and build (e. g. "mvn clean install -u") in the right project directory.


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.


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


in my case with tomcat projects i have checked project here: window - preferences - tomcat - source path - add java projects to source path


in my case the maven version of the other referenced project didn't match the version of the test project. once they were the same, the problem disappeared.


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


if you want to attach source code to any jar by auto-downloading, try using this eclipse plugin java source attacher

enter image description here


i had this problem while working on java code to do process on a excel file containing a data set, then convert it to .csv file, i tried answers to this post, but they did not work. the problem was the jar files themselves. after downloading needed jar files one by one(older releases) and add them to my project, "source not found" error vanished. maybe you can check your jar files. hope this would help.


this worked for me

right click on project -> properties -> deployment assembly -> add your jar


go to debug configuration in eclipse and use below goal to run your application.



-dmaven.surefire.debug exec:java


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.


for beginners,

there is a possibility that the jar file is a part of the project which you have not yet included in the eclipse workspace.

for that, you need to know the project name of the jar file. say for example, its abc-18.0.0-snapshot.jar, it means that the project you are supposed to include in your workspace is abc.


i had the same issue with eclipse 2019-03 (4.11.0) and i was only able to solve this by doing the debugging via remote debugging instead of directly launching it in debug mode.


attach source -> add -> external archive -> select the jar -> open -> done

the catch is look for the sources jar and attach this jar.

for example the jar ends with "-sources" stax2-api-3.4.1-sources


sometimes these thing happens because of the version also like if you are using latest version in that case it may arise try to use older version it will work.


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:

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:

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:




in my case in "attach source", i added the other maven project directory in the "source attachment configuration" panel. adding the latest version jar from the m2 repository din't work. all the classes from the other maven project failed to open.

enter image description here

here test was my other maven project containing all the java sources.


evidently, eclipse does not automatically know where the source code for the dependent jars are. it is not clear why debugger could not inspect variables once the source was attached. one possibility is incorrect/incompatible source.

assuming you have a maven project and the sources of the dependencies are downloaded and available in the local repository, you may want to install m2eclipse, the maven eclipse plugin and see if that helps in addressing your issue.


in my case, even after editing source lookup and adding project, it didn't worked. i configured the build path of the project.

enter image description here

after that, i selected jre system library and it worked.

enter image description here


click -> edit source lookup path

after then

click -> add finally select java project and select project path.



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


none of the mentioned answer worked for me.

to resolve this issue i have to follow bellow steps:

  • right click on java hotspot(tm) 64 bit server.
  • select "edit source lookup".
  • click on "add".
  • select "file system directory" instead of java project.
  • select root directory of your project.
  • check "search subfolders".
  • click ok ok ok.



remove the existing debug configuration and create a new one. that should resolve the problem.


i was facing the same issue,i followed the bellow steps.

window => preferences => java => installed jres,

enter image description here

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.

enter image description here

click on the directory, browse for jdk, it should look like bellow screen. enter image description here

click ok, and its done


i had similar problem with my eclipse maven project. i fought with this issue quite a long time then i tried to rebuild project with

mvn clean eclipse:eclipse

and it helped.

note: using this approach will confuse the m2e plugin since the two approaches are very different. m2e adds a virtual node to your project called "maven dependencies" and asks maven to add all dependencies there.

mvn eclipse:eclipse, on the other hand, will create a lot of individual entries in the file .classpath. eclipse will handle them as if you manually added jars to your project.

unless you know how the classpath in eclipse works, this approach is not recommended.



"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


the symptoms perfectly describes the case when the found class doesn't have associated (or assigned) source.

  • you can associate the sources for jdk classes in preferences > java > installed jre. if jre (not jdk) is detected as default jre to be used, then your jdk classes won't have attached sources. note that, not all of the jdk classes have provided sources, some of them are distributed in binary form only.
  • classes from project's build path, added manually requires that you manually attach the associated source. the source can reside in a zip or jar file, in the workspace or in the filesystem. eclipse will scan the zip, so your sources doesn't have to be in the root of the archive file, for example.
  • classes, from dependencies coming from another plugins (maven, pde, etc.). in this case, it is up to the plugin how the source will be provided.
    • pde will require that each plugin have corresponding xxx.source bundle, which contains the source of the plugin. more information can be found here and here.
    • m2eclipse can fetch sources and javadocs for maven dependencies if they are available. this feature should be enabled m2eclipse preferences (the option was named something like "download source and javadocs".
    • for other plugins, you'll need to consult their documentation
  • classes, which are loaded from your project are automatically matched with the sources from the project.

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.


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.

Related Query

More Query from same tag