在尝试设置断点时,我在Eclipse中得到这个奇怪的错误。
Unable to insert breakpoint Absent Line Number Information
我勾选了编译器选项的复选框,但运气不好。
在尝试设置断点时,我在Eclipse中得到这个奇怪的错误。
Unable to insert breakpoint Absent Line Number Information
我勾选了编译器选项的复选框,但运气不好。
当前回答
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.
其他回答
在调试部署到Tomcat的WAR(由多个Eclipse项目构件构造)时,我遇到了同样的问题。
我正在使用ANT构建脚本构建所有内容。如果这是您正在做的事情,请确保在您获得的每个javac ant任务上设置了debug=true标志。这是我唯一的问题-我希望它能帮助你的问题!
我在试图从Eclipse以调试模式启动Tomcat时遇到了这个问题。我有一个ANT构建文件负责编译和部署。在将调试标志设置为true(如其他答案所述)并重新部署应用程序后,它可以正常工作:
<javac srcdir="./src/java" destdir="./bin" debug="true">
注意:如果您刚刚添加了调试标志并重新编译,那么仍然需要将应用程序重新部署到服务器,因为Eclipse就是在服务器上调试类文件的。很明显,但很容易花一个小时左右的时间挠头,想知道为什么它不管用(相信我)。
我发现了这条信息的另一个原因。我在编程Scala。解决方案是:
打开运行->调试配置 在主选项卡的底部,在“应用”和“恢复”按钮旁边,有一个文本说明你正在使用哪个启动器,旁边有一个超链接说“选择其他”。这是一个奇怪的UI元素,乍一看并不可行。 使用“选择其他”链接并选择“Scala应用程序(新调试器)启动器”。另一个似乎不能与Scala一起工作。
现在调试应该可以工作了。注意,我已经安装了Scala IDE插件,如果您没有这个选项,那么这个选项可能是不可用的。
在编译/构建jar时,我做了上面列出的所有事情-仍然有同样的问题。
最终,在启动服务器时,下面列出的jvmarg更改最终为我工作:
删除/注释了一堆与javaagent和bootclasspath相关的jvm参数。
<!-- jvmarg value=“${agentfile}” /-->
< !贾维德- lib /雷丁——>
<!-- jvmarg value=“-Xbootclasspath/a:/foo /-->
打开/取消注释以下行:
<jvmarg value= -Xdebug />
然后,当我启动服务器时,我就可以到达断点了。我怀疑javaagent在某种程度上干扰了Eclipse检测行号的能力。
对于使用Tomcat服务器的Web项目,我通过以下步骤解决了这个问题。
打开窗口->显示视图->其他->服务器。 双击运行中的tomcat服务器。(打开tomcat服务器概述) 现在点击启动配置链接。 单击sources选项卡。 单击Add。 选择java项目 将显示您的所有项目。 选择打开“您要调试。” 保存配置并重新启动或构建应用程序。