Java Debugging: Source not found

后端 未结 3 470
无人及你
无人及你 2020-12-13 20:05

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

相关标签:
3条回答
  • 2020-12-13 20:43

    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"?

    0 讨论(0)
  • 2020-12-13 20:52

    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

    0 讨论(0)
  • 2020-12-13 20:56

    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

    0 讨论(0)
提交回复
热议问题