6

I am using the eclipse3.4.6 and I have attached the src.zip to eclipse. I can successfully view the source code eclipse, but the breakpoint set in java core class dosn't work; for example.

HashMap test = new HashMap();
test.put("a", 0);

I can't step into test.put("a", 0) even if I set a breakpoint in HashMap.class at the begenning of 'put' method.

Thanks in advance.

goddyang
  • 57
  • 1
  • 3

2 Answers2

7

Please make sure you are using JDK not JRE in build path of your project.

Wojciech Owczarczyk
  • 5,595
  • 2
  • 33
  • 55
  • I acttually used JRE in build path,but how can I use JDK in build path of my project. – goddyang Jan 04 '12 at 14:27
  • @goddyang rightclick on the project->Properties->Java Build Oath->Libraries->Remove JDK->Add Library->JRE System Library->Choose your JDK – Tom Seidel Jan 04 '12 at 14:32
  • It works.Thanks a lot.What's the difference between these two conditions? Should I google with key words 'jdk jre buildpath'? – goddyang Jan 04 '12 at 14:58
  • 1
    JDK compiled classes located inside rt.jar are compiled with debug info. More info here: http://stackoverflow.com/questions/5288370/how-to-debug-class-files-in-eclipse – Wojciech Owczarczyk Jan 05 '12 at 08:03
1

I think you might be setting a "line breakpoint" which Eclipse isn't able to map to the right line possible because the source you are looking at is not exactly the same as that of the class that is running.

Try setting a "method breakpoint" instead. Open the HashMap class and in the Outline view, right click the put method and select Toggle Method Breakpoint.

dogbane
  • 266,786
  • 75
  • 396
  • 414
  • You mean the source code can't match the .class file?Wojtek O. has fiexd the problem. Thank you all the same, and I learn the 'method breakpoint' ^_^ – goddyang Jan 04 '12 at 15:04