在尝试设置断点时,我在Eclipse中得到这个奇怪的错误。
Unable to insert breakpoint Absent Line Number Information
我勾选了编译器选项的复选框,但运气不好。
在尝试设置断点时,我在Eclipse中得到这个奇怪的错误。
Unable to insert breakpoint Absent Line Number Information
我勾选了编译器选项的复选框,但运气不好。
当前回答
我的问题是我有2个JAR,我试图根据Eclipse中的Java Build Path => order & Export选项卡中的顺序覆盖另一个JAR,因为一个是用于调试的,另一个不是(调试JAR在顺序中是第一个)。当我这样做时,我必须手动附加一个源。
我尝试删除非调试JAR,并将调试JAR放在我的\WEB-INF\lib\目录中,进行清理、构建等操作,结果成功了。这一次(已经删除了附加的源代码),它将自动让我浏览调试代码,而无需手动附加任何源代码。断点和调试也可以工作。
为了防止有人仍然有问题,我也尝试了其他答案中提到的所有这些特解:
取消选中,应用并重新选中添加行号属性… 手动编辑org.eclipse.jdt.core.prefs,如另一个答案:https://stackoverflow.com/a/31588700/1599699中提到的 确保在启用调试的情况下生成JAR。 将JDK遵从级别从1.6更改为1.7(从而匹配我正在使用的JDK)。
我还做了通常的服务器关闭(并确保java.exe实际上是关闭的……),删除两个项目中的\build\目录,使用-clean参数重新启动Eclipse,重新创建调试JAR,刷新,清洗,并在其中构建带有调试JAR的项目,以调试模式启动服务器,发布/清洗,并设置断点。
其他回答
我在eclipse IDE中也遇到了同样的问题。我阅读了这个问题的所有答案,并尝试了几乎所有提到的设置,但运气不好。
所以,我尝试改变项目的运行时库,以前它是JRE - Java SE 1.8
我尝试将JRE更改为JDK,它为我工作:
从JRE切换到JDK的步骤如下:
Right click on project Click Properties -> Java Build Path Select tab - "Libraries" Click on "Add Library" button. "Add Library" window will open Select "JRE System Library" -> Click Next button Select "Alternate JRE" Click on Installed JRE button In New window click on "Add". This will open another window "Add JRE". Select "Standard VM". Click Next. Click on Directory button. Choose path of your "JDK" installation directory and click ok. Then Click Finish. Now check on newly added "JDK" Delete all other installed JRE's from the list(Optional) Apply-> OK Select "JDK from alternate JRE dropdown and Click on "Finish" Now from the list depicted below remove JRE instance Click Apply -> OK
你完蛋了!!
我的问题是我有2个JAR,我试图根据Eclipse中的Java Build Path => order & Export选项卡中的顺序覆盖另一个JAR,因为一个是用于调试的,另一个不是(调试JAR在顺序中是第一个)。当我这样做时,我必须手动附加一个源。
我尝试删除非调试JAR,并将调试JAR放在我的\WEB-INF\lib\目录中,进行清理、构建等操作,结果成功了。这一次(已经删除了附加的源代码),它将自动让我浏览调试代码,而无需手动附加任何源代码。断点和调试也可以工作。
为了防止有人仍然有问题,我也尝试了其他答案中提到的所有这些特解:
取消选中,应用并重新选中添加行号属性… 手动编辑org.eclipse.jdt.core.prefs,如另一个答案:https://stackoverflow.com/a/31588700/1599699中提到的 确保在启用调试的情况下生成JAR。 将JDK遵从级别从1.6更改为1.7(从而匹配我正在使用的JDK)。
我还做了通常的服务器关闭(并确保java.exe实际上是关闭的……),删除两个项目中的\build\目录,使用-clean参数重新启动Eclipse,重新创建调试JAR,刷新,清洗,并在其中构建带有调试JAR的项目,以调试模式启动服务器,发布/清洗,并设置断点。
在编译/构建jar时,我做了上面列出的所有事情-仍然有同样的问题。
最终,在启动服务器时,下面列出的jvmarg更改最终为我工作:
删除/注释了一堆与javaagent和bootclasspath相关的jvm参数。
<!-- jvmarg value=“${agentfile}” /-->
< !贾维德- lib /雷丁——>
<!-- jvmarg value=“-Xbootclasspath/a:/foo /-->
打开/取消注释以下行:
<jvmarg value= -Xdebug />
然后,当我启动服务器时,我就可以到达断点了。我怀疑javaagent在某种程度上干扰了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.
在使用Spring Tool Suite (STS)启动Java EE项目时,我们也会遇到这个消息,但是我们可以忽略这个消息,因为一切都很好。