在尝试设置断点时,我在Eclipse中得到这个奇怪的错误。

Unable to insert breakpoint Absent Line Number Information

我勾选了编译器选项的复选框,但运气不好。


当前回答

我在一个特定的项目中遇到了同样的问题,我一直试图重置窗口中的行号属性->首选项…然后我意识到每个项目都有自己的行号属性设置。右键单击项目,进入属性,选择JavaCompiler,并选中“添加行号属性…”

其他回答

这解决了我的问题:

窗口->首选项->服务器->运行时环境 Apache Tomcat ->编辑 选择JDK而不是JRE

从Spring AOP得到这个消息(似乎来自CGLIB库)。点击忽略似乎工作正常,我仍然可以调试。

当我用@ManagedBean (javax.annotation.ManagedBean)注释类时,我发现了这个问题。在JBoss EAP 6.2.0上运行新编译的应用程序时出现警告消息。忽略它并继续运行并没有帮助——断点从未到达。

我在JSF页面中使用EL调用该bean。现在…@ManagedBean可能不适合(我是CDI的新手)。当我将注释更改为@Model时,bean执行了,但断点警告也消失了,我像预期的那样击中了断点。

总之,看起来@ManagedBean注释弄乱了行号,不管它是否使用了错误的注释。

If someone is trying to debug Java's source code, then, this is the only solution that worked for me. Most of the above answers talk about setting the Compiler option to generate line numbers.But, if want to debug Java's source code (say java.util.HashMap), then the above options may not work for you. This is because , the project from where you intend to debug the source code is having the Java Build Path --> Library --> JRE System Library pointing to the jre jar instead of the jdk jar. The classes bundled inside jre jar have already been pre-compiled with a specific option, that will not honor the Compiler option settings. Solution, is to reconfigure your project to have the JRE System Library point to the jdk jar. The classes inside your jdk jar will honour the Compiler option settings. So, once you update your project's JRE System Library to point to the jdk jar, debug on Java source code will start working.

在eclipse菜单中,进入“窗口->首选项->Java->编译器” 取消标记复选框“添加行号属性…” 单击“应用”->是 标记复选框“添加行号属性…” 再次申请。 愉快调试