Eclipse java debugging: source not found

后端 未结 30 1995
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:24

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

提交回复
热议问题