Eclipse java debugging: source not found
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".
Why does the Eclipse debugger give the error Source not found seemingly without reason?
Eclipse doesn't crash. You're trying to step into a method, where eclipse doesn't know where to find the source (*.java
) files and informs you about this. Here is how to tell eclipse where to look. Go to
Window -> Preferences -> Java -> Installed JREs, select the JRE you are using and click Edit.
There, select all of the jar files in the list you see and and click Source Attachment....
In the window that shows up, select the fille src.zip
, which is in your JDK folder (if you didn't uncheck it while installing the JDK). On the machine I'm on right now, that is
C:\Program Files\Java\jdk1.7.0_07\src.zip
.
Save all your changes (possibly restart eclipse) and you won't see that error again.
I get Source not found when debugging my Java code in Eclipse
Sounds like the 'source lookup path' section if you edit the debug configuration isn't setup correctly?
Eclipse - Source not found
Well it turns out the solution was anticlimactic. When Balder's recommendations did not work I tried debugging one of the stock OpenFire plugins and it worked just fine. I then created a new plugin from scratch, and by doing nothing other than adding the source to the project (Right-click on the project -> New -> Source Folder) it also worked just fine. I have no idea why Eclipse refuses to see the source for my original plugin, but I moved all my code and libraries over to the new plugin and debugging is working as expected.
Eclipse debugging source not found
I had this very annoying problem for a long time but was finally able to solve it. In my case, a null pointer exception was being thrown somewhere in Java's Transformer.IsRuntimeCode(ProtectionDomain) function.
I didn't really need to know about this since the exception was being caught and handled, but eclipse would pause debugging every time this happened and tell me that the source wasn't available. As a result, I constantly had to keep pressing the button to continue code execution.
In order to prevent this from happening, I:
- Clicked on the "Breakpoints" window
at the bottom of the debugging
screen - Right clicked "NullPointerException"
- Unchecked "Caught"
This prevented the debugger from pausing program flow during a caught NullPointerException.
(source: SharpDetail.com)
Eclipse Debug: Source Not Found while remote debugging
In this scenario just follow the following steps:
- Go to Run → Debug Configurations
- Select the remote application configuration being debugged.
- Select the second tab named 'Source'
- Now add the folder/projects containing the source code explicitly here.
Related Topics
Why Are Filenames in Java the Same as the Public Class Name
How to Map an Entity Field Whose Name Is a Reserved Word in JPA
How to Switch Between Frames in Selenium Webdriver Using Java
Tomcat 10.0.4 Doesn't Load Servlets (@Webservlet Classes) with 404 Error
Java - Best Approach to Parse Huge (Extra Large) JSON File
Nosuchmethoderror in Javax.Persistence.Table.Indexes()[Ljavax/Persistence/Index
String, Stringbuffer, and Stringbuilder
What Is Suppresswarnings ("Unchecked") in Java
Why Is There No Multiple Inheritance in Java, But Implementing Multiple Interfaces Is Allowed
Spring Boot and Multiple External Configuration Files
How to Specify the Java Compiler Version in a Pom.Xml File
How to Programmatically Download a Webpage in Java
Can You Recommend a Java Library for Reading (And Possibly Writing) CSV Files