在尝试设置断点时,我在Eclipse中得到这个奇怪的错误。
Unable to insert breakpoint Absent Line Number Information
我勾选了编译器选项的复选框,但运气不好。
在尝试设置断点时,我在Eclipse中得到这个奇怪的错误。
Unable to insert breakpoint Absent Line Number Information
我勾选了编译器选项的复选框,但运气不好。
当前回答
在eclipse菜单中,进入“窗口->首选项->Java->编译器” 取消标记复选框“添加行号属性…” 单击“应用”->是 标记复选框“添加行号属性…” 再次申请。 愉快调试
其他回答
我的问题是我有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的项目,以调试模式启动服务器,发布/清洗,并设置断点。
检查/做以下事情:
1)在“窗口—>首选项—> Java—>编译器—>类文件生成”下,所有选项必须为True:
(1) Add variable attributes...
(2) Add line number attributes...
(3) Add source file name...
(4) Preserve unused (never read) local variables
2)在项目的.settings文件夹中,找到一个名为org.eclipse.jdt.core.prefs的文件。 验证或设置org.eclipse.jdt.core.compiler.debug.lineNumber=generate
3)如果仍然出现错误窗口,单击复选框不显示错误信息。
4)清洁和建造项目。开始调试。
正常情况下,错误窗口不再显示,调试信息显示正确。
我在Eclipse IDE中也有同样的错误。 但这似乎是一个可以忽略的错误。 我在错误对话框上按下Ok键,然后继续。 我的断点到达&我能够进一步调试。
不知道这是否仍然相关,也许另一个水手会发现这有用。
当已编译的类文件关闭调试标志时,将出现该消息。
在eclipse中,您可以通过前面提到的选项打开它,
窗口—>首选项—> Java—>编译器—>类文件生成:“添加行号属性生成类文件”
但是如果您有一个jar文件,那么您将得到编译后的输出。解决这个问题没有简单的方法。
如果您可以访问源代码并使用ant来获取jar文件,那么您可以如下所示修改ant任务。
<javac destdir="${build.destDir}" srcdir="${build.srcDir}" source="1.6" fork="true" target="${javac.target}" debug="on" debuglevel="lines,vars,source" deprecation="on" memoryInitialSize="512m" memoryMaximumSize="1024m" optimize="true" >
快乐的调试. .
裁判: http://doc.sumy.ua/prog/Java/javanut/ch16_04.htm
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.