Scott Rice
Scott Rice

Reputation: 1165

Java Debugging: Source not found

I am having a problem with Eclipse where I can run my program just fine, but when I try to start the debugger, I get this message

Eclipse Window showing error

The picture is a little hard to make out, but instead of getting the normal debugging window, instead it says it is throwing a ClassNotFoundException, and is trying to dislay the source for Launcher$ExtClassLoader.

The thing that really baffles me though is that I can run the code just fine, it is only when I click the debug button that I have the problem.

I have also tried debugging at the command line with JDB, and I got the same error.

So far, I have tried Reinstalling Eclipse and downloading (what I believe to be) the correct Java Development tools for Mac OS X.

I have no idea what else I can try, so any help would be greatly appreciated. Let me know if there is any other information I can provide.

Upvotes: 19

Views: 27210

Answers (3)

ssasa
ssasa

Reputation: 1615

Source not found might be legitimate for dynamically loaded code (e.g. Maven).

There are three workarounds known to me (after months of search):

  1. Connect to a running JVM with the debugger and you will see the code.

  2. Use Dynamic Source Lookup plugin for Eclipse from here:

    https://github.com/ifedorenko/com.ifedorenko.m2e.sourcelookup

  3. Use run-jetty-run Maven plugin

    http://code.google.com/p/run-jetty-run/

I prefer and recommend 3. It works and starts webapp much faster than jetty:run.

Unfortunately 2. didn't helped me as it has issues with Windows paths with spaces.

I have filled an enhancement request on Eclipse Bugzilla and if you agree this issue "Source not found" should vanish forever, please vote for it here:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=384065

Upvotes: 44

Russell Zahniser
Russell Zahniser

Reputation: 16354

The "source not found" is a red herring - there may simply be no way to get access to the source that is throwing the error, because it is deep in the guts of the debugger's class loader.

The better question, then, is, "Why is scottrice.ChessPuzzles.ChessPuzzleDriver not being found?" The only possibility that occurs to me at the moment is that something might be weird in your debug configuration. Did you debug the program by just right-clicking a file with a main() and choosing "Debug As" -> "Java Application"?

Upvotes: 0

Chan
Chan

Reputation: 2641

Do you have the sources for the files that you are using. If you are using Maven (M2Eclipse) you could download the sources. This might solve the problem. enter image description here

Otherwise you could go and manually attach your sources. Here is how you manually attach sources.

Getting the library paths

Next you have to attach the sources-

Attaching sources

Hope this helps

Upvotes: 8

Related Questions