简体   繁体   中英

Eclipse Java Debugger Source Lookup Path

I have two Java eclipse projects in my workspace. Project ProjectA has class ClassA inside package packageA , and likewise, project ProjectB has class ClassB inside package packageB .

I have this simple code:

// ClassA.java
package packageA;

import packageB.ClassB;

public class ClassA {

    public static void main(String[] args) {
        ClassB b = new ClassB();
        String str = b.getStr();
        System.out.println(str);
    }

}


// ClassB.java
package packageB;

public class ClassB {
    private String str;

    public ClassB() {
        str = "Hello, World!";
    }

    public String getStr() {
        return str;
    }
}

The Problem : I am trying to debug main in ClassA . When I step into the ClassB constructor, I get the error "Source not found" with the button "Edit Source Lookup Path...". I tried to fix this by adding ProjectB to the "Source" tab of ProjectA 's debug configurations, but still getting the same error.

The question : How do I fix this issue?

I solved this issue as follows: When I encounter the "Source not found" page, I step out with the debugger a few times, until I get back to where I was in my code. Then, I step into again, and this time it works.

For reference, please see this answer .

它们需要位于同一软件包中,或者尝试使用maven项目并通过pom.xml包含所需的软件包。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM