1.环境:windows7 + eclipse4.6.2+ JDK1.8
2.问题:在某个工程内设置断点之后,调试时断点无效,-也就是程序会直接运行到最后,正常执行不报错。
eclipse的工作空间内有好几个工程,但 只有在某个工程断点无效,在其他工程内断点是有效的。
3.采取过的措施:
1.将工程(都是maven工程)删掉,再重新import。无效。
2.选择Skip All Breakpoints,无效(网上流传最广的方法)。
3.选择Remove All Breakpoints,再重新设置断点,还是无效。
4.菜单栏Window→Preferences→Java→Debug 去掉suspend execution on uncaught exceptions和Suspend execution on compilation errors前面两个勾勾,再把Debugger timeout(ms)设置为不少于15000ms
5.菜单栏Window→Preferences→Java Compiler-->Classfile Generation,勾选上Add line number attributes to generated class files(used by the debugger)
选定工程,选定工程,选定工程,(重要事说三遍)点击右键-->Properties-->Java Compiler-->Classfile Generation,勾选上Add line number attributes to generated class files(used by the debugger)。
然后就可以了。
2.问题:在某个工程内设置断点之后,调试时断点无效,-也就是程序会直接运行到最后,正常执行不报错。
eclipse的工作空间内有好几个工程,但 只有在某个工程断点无效,在其他工程内断点是有效的。
3.采取过的措施:
1.将工程(都是maven工程)删掉,再重新import。无效。
2.选择Skip All Breakpoints,无效(网上流传最广的方法)。
3.选择Remove All Breakpoints,再重新设置断点,还是无效。
4.菜单栏Window→Preferences→Java→Debug 去掉suspend execution on uncaught exceptions和Suspend execution on compilation errors前面两个勾勾,再把Debugger timeout(ms)设置为不少于15000ms
5.菜单栏Window→Preferences→Java Compiler-->Classfile Generation,勾选上Add line number attributes to generated class files(used by the debugger)
这个问题找到原因了:真是Ri了Dog了,不知道什么时候把不能debug的这个工程的line number给取消了,工程编译的时候没有设置line number,导致调试的时候无法定位,
关键是:这个line number设置是针对某个工程的,而不是整个平台的环境变量 ,
所以才会出现有的工程行,有的工程不行的情况
解决方法如下:选定工程,选定工程,选定工程,(重要事说三遍)点击右键-->Properties-->Java Compiler-->Classfile Generation,勾选上Add line number attributes to generated class files(used by the debugger)。
然后就可以了。