Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

eclipse debug: Source not found for

I know this is a frequently asked question, but i have been searching for a solution for my problem online since yesterday and have not been able to find any!

I am using Eclipse Helios with Tomcat 6.0.2, when ever I try to debug my code using the tomcat and eclipse i am getting the error Source not found, this is the case for even the code that i have wrote myself and not just all the jar files

I have the java build path set up correctly, I am also using jdk1.6.0 and have this set up correctly as well so that is not the problem, it does show the code when i am debugging if i right click on the debug console and go to Edit Source Lookup.... Because this will show the source code just for that run of the debugger, I when into Run -> Debug Configurations and in the Java Application window i set it up to work with Tomcat and in the source tab I added my project and all the jar files but this does not work either! when i debug again and go into the Edit Source Lookup... it does not show me the project and jar files that I have saved in there

Does anybody have any ideas what might be happening?

like image 561
Hip Hip Array Avatar asked Jul 04 '12 08:07

Hip Hip Array


People also ask

How do I enable debugging in Eclipse?

A Java program can be debugged simply by right clicking on the Java editor class file from Package explorer. Select Debug As → Java Application or use the shortcut Alt + Shift + D, J instead.


2 Answers

Its actually very easy.Click on "Edit Source Look Path". You ll get the next popup where you need to click "Add"--> This gives another popup where you could click on "Java Project"---> THis leads to another popup where you can select your project which you are debugging and this is done! Hope this works fine.

enter image description here

like image 114
Shiv Kumar Ganesh Avatar answered Sep 20 '22 17:09

Shiv Kumar Ganesh


I have solved my problem, well in a roundabout way. In my catalina.bat file I have added the line

set JAVA_OPTS= -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=5001,server=y,suspend=n %JAVA_OPTS%

below where the JAVA_OPTS are set, this will listen on socket 5001 for any debug requests. Then in eclipse, under Debug Configurations... i created a new Remote Java Application and set the port to 5001 so that Tomcat would pick this up. Now when i start tomcat using startup.bat, when the code hits a breakpoint it opens in eclipse and I can debug like normal

Hope this helps others that have this problem

like image 39
Hip Hip Array Avatar answered Sep 21 '22 17:09

Hip Hip Array