22 September 2009

Eclipse "Source not found" error when debugging


When debugging a project in Eclipse some times the error ‘Source not found’ is thrown with the option ‘EditSourceLookup Path’ to specify the path to the source code. Even having the correct path for the source code defined the error still happens.

In my case the error happened because Eclipse tried to find the source code for the JRE classes, however it was not defined in the path of my project. I solved it by adding the library for the JRE and adding the classpath variable as part of the path. There is also an option to add the JRE source code (‘Attach Source…’), so Eclipse finds the Java source code when needed.

This often happens when an exception is thrown, so Eclipse tries to continue debugging through the Java or external libraries code, what is normally not available.  Very common for NullPointerException.



No comments:

Post a Comment