在尝试设置断点时,我在Eclipse中得到这个奇怪的错误。
Unable to insert breakpoint Absent Line Number Information
我勾选了编译器选项的复选框,但运气不好。
在尝试设置断点时,我在Eclipse中得到这个奇怪的错误。
Unable to insert breakpoint Absent Line Number Information
我勾选了编译器选项的复选框,但运气不好。
当前回答
这解决了我的问题:
窗口->首选项->服务器->运行时环境 Apache Tomcat ->编辑 选择JDK而不是JRE
其他回答
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.
检查/做以下事情:
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)清洁和建造项目。开始调试。
正常情况下,错误窗口不再显示,调试信息显示正确。
如果上述解决方案不起作用,并且你在做了spring bean注入后开始遇到这个问题,问题可能是你没有为注入类使用接口。尝试使用实现接口的类进行注入可以解决这个问题。下面是一个例子: 无法安装用于创建bean的断点问题
我在Spring MVC + Maven项目上也有类似的问题;并且花了2个小时试图弄清楚为什么目标文件夹没有更新包含行信息的类。
我建议您清理所有内容,并确保在继续进行任何构建之前从文件夹中删除所有类。
确保在项目的属性> Java编译器有“添加行号属性生成类字段(由调试器使用)选择。 清洁所有项目。(菜单>项目>清洁…)确保目标文件夹为空。 构建项目(菜单>项目>构建项目) 确保在目标目录中生成了新类。 运行调试;如果在WebServer上运行,请确保在“调试”模式下运行web服务器。
如果有疑问——编译后的.class文件是否包含行号——在Eclipse中打开.class文件。Eclipse将反编译文件并告诉您行号是否存在。
以上这些都对我不起作用。 下面的解决方案终于奏效了。 调试配置->类路径->用户条目->(添加要调试的项目的src文件夹)