Håkon Hægland
Håkon Hægland

Reputation: 40718

Debugging java source file with multiple classes in eclipse: Source not found

I have similar problem to the one described here: Eclipse and Java - source not found

I also looked at the following question: Eclipse java debugging: source not found but I could not see how that it applied to my case..

I have just started using Eclipse and its debugger. Here is how to reproduce the problem using Eclipse 3.7.2 on Ubuntu 12.04 with java and javac version 7.

I now have the following screenshot:

enter image description here

enter image description here

enter image description here

Now the error is reported:

enter image description here

Any help on this issue is appreciated..

Upvotes: 1

Views: 2291

Answers (2)

Holger
Holger

Reputation: 298103

The class Launcher$AppClassLoader belongs to the JRE and is about to load your class. It has nothing to do with the source code of your own classes. If you step further you will reach your own class Test2. If you go to the end of your debug button bar (four buttons right to the “step into” button), there’s a “Use step filters” button. Activate it to avoid unnecessary steps into the JRE classes.

Upvotes: 2

Rhycce
Rhycce

Reputation: 111

I believe you have to create an instance of Test before you can access the nested class Test2 in Test. Eclipse should have thrown an error in yours saying something like "No instance of Test2 is accessible" or something like that. Change your code to look like this and see if it works.

public class Test {

/**
 * @param args
 */
public static void main(String[] args) {
    // TODO Auto-generated method stub
        Test mTest = new Test();
        Test2 nTest = mTest.new Test2(1);
}

class Test2{
    int i;

    Test2(int i){
        this.i = i;
    }
}

}

Upvotes: 0

Related Questions