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.
- Start Eclipse and select workspace, e.g., "Test" in home folder.
- Open java perspective
- Open new java project with project name "Test"
- Add a new java class "Test"
I now have the following screenshot:
enter image description here
- Add the following code to the source file
Test.java
enter image description here
- set a breakpoint at
new Test2(1) - open debug perspective
- start debugging:
enter image description here
- choose
Step Into (F5)
Now the error is reported:
enter image description here
Any help on this issue is appreciated..
-
Have you tried cleaning the project? (Project->Clean... and select your project)luanjot– luanjot2013年11月18日 16:26:20 +00:00Commented Nov 18, 2013 at 16:26
-
I tried cleaning now, it did not help.. I still get the same error..Håkon Hægland– Håkon Hægland2013年11月18日 16:29:19 +00:00Commented Nov 18, 2013 at 16:29
2 Answers 2
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.
4 Comments
Test2 class.. I will try your advice regarding the step filters..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;
}
}
}