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?
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.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With