I get "Source not found" when debugging my Java code in Eclipse

Viewed 89496

I'm trying to debug my Java application in Eclipse however when I hit a breakpoint I simply see the following instead of my source:

Source not found message

If I change the stack frame in the Debug window then I can see the function name change in the tab - this is definitely my code, the line number is correct and I'm using the latest build but I still can't get Eclipse to show the source (despite it being open in another tab!)

I'm new to Eclipse and so I'm struggling to find my way around, but everything that I've stumbled across so far seems fine to me.

What might cause this to happen and how can I fix it?

16 Answers

This is an expansion on JAB's answer: Click "Edit Source Lookup..." > Add... > Workspace Folder > Project > select your folder > check Search subfolders box > OK.

In Eclipse:Window-->Go to preferences-->Java-->Click on JRE-->Edit--->Restore Default and click on Finish.

Update your Project before Debugging the code!

Alas! It worked for me.

This occurred to me when my working git branch is updated from code in master branch. I have already run mvn clean install after the pull, but seems I had to update projects after the maven build so that project source code and JAR build code gets synchronized.

Right click on your project -> Maven -> Update Project, then select all the maven modules available and press OK. This resolved the issue for me.

enter image description here

Related