Eclipse java debugging: source not found

后端 未结 30 1637
Happy的楠姐
Happy的楠姐 2020-11-22 15:43

While debugging a java app in eclipse I receive a \"Source not found\" error in two cases:

  • Stepping in to a file in a different project which
相关标签:
30条回答
  • 2020-11-22 16:39

    From http://www.coderanch.com/t/587493/vc/Debugging-Eclipse-Source

    "When running in debug mode, right click on the running thread (in threads tab) and select Edit Source Lookup. At this point, you should be able to add the necessary project/jar which contains your source code."

    I added my current project in this way, and it solved my problem

    0 讨论(0)
  • 2020-11-22 16:40

    Info: This is a possible solution, when you use maven (pom.xml) with couple of projects.

    If you are working with maven, make sure what version you are taking inside the according pom.xml (e. g. 1.0.1-SNAPSHOT ). It might be possible that your code is up-to-date, but your pom.xml dependencies are still taking the old JAR's/Snapshots (with the old code).

    Finding the problem:

    • Try to debug the according file.
    • Therefore, set a breakpoint in the relevant code area.
    • When "source not found" appears, make sure to bind in the right project (where the .java file can be found).
    • The compile .class file opens up in the IDE editor.
    • Click "Link with Editor" to find the according JAR/Snapshot.
    • Now make sure that this JAR is the most recent one. Possibly there is a newer one. In that case, write the most recent version number in the pom.xml.
    • Then do a maven update and build (e. g. "mvn clean install -U") in the right project directory.
    0 讨论(0)
  • 2020-11-22 16:41

    Click -> Edit Source Lookup Path

    after then

    Click -> Add finally select Java project and select project path.

    Source: https://www.youtube.com/watch?v=IGIKPY6q1Qw

    0 讨论(0)
  • 2020-11-22 16:41

    this worked for me

    right click on project -> Properties -> Deployment Assembly -> add your jar

    0 讨论(0)
  • 2020-11-22 16:41

    I had the same issue with eclipse 2019-03 (4.11.0) and I was only able to solve this by doing the debugging via remote debugging instead of directly launching it in debug mode.

    0 讨论(0)
  • 2020-11-22 16:43

    In eclipse photon try to turn off "Window->Preferences->Java->Debug->Use advanced source lookup"

    Edit: There is a related bug in this version of eclipse which leads to a "source not found" message while debugging Java applications. See bug report bugs.eclipse.org/bugs/show_bug.cgi?id=537699 for more details

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