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

Unable to insert breakpoint Absent Line Number Information

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


当前回答

我几乎试过了这里所有的解决方案,但都不走运。你试过点击"别再跟我说"吗?这样做之后,我重新启动了我的程序,一切都很好。Eclipse碰到我的断点时,好像什么都没有发生。

对我来说,根本原因是Eclipse试图为自动生成的Spring CGLIB代理对象设置调试。除非你需要调试这个级别的东西,否则你应该忽略这个问题。

其他回答

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

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

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

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

我也遇到了同样的问题,我花了很多时间去寻找解决方案,但这些解决方案都是无用的,所以我自学了所有的案例,最后我发现问题是JDK版本之间的冲突。 以下是解决问题的步骤: 1. 删除所有JDK和JRE版本,只保留一个版本。 2. 在Eclipse中设置JAVA_HOME系统和java编译器是一样的。 在某些情况下,上面的错误不会消失,但我们能够运行在调试模型。

因为我安装了6个不同版本的Java,所以我必须更改默认的JDK遵从性,以匹配我想使用的Java版本。当所有内容都使用Java 1.6构建/编译时,Eclipse默认将编译器遵从级别设置为Java 1.7。

所以我所做的就是

在eclipse菜单中,进入“窗口->首选项->Java->编译器” 在JDK遵从性下,我将编译器遵从性级别从1.7更改为1.6

现在Eclipse不再抱怨“无法插入缺少行号信息的断点”,并且调试断点实际上工作了!!

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.