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

Unable to insert breakpoint Absent Line Number Information

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


当前回答

我尝试了之前的大部分解决方案,但还是遇到了问题。 这就是我接下来所做的:

从Eclipse中删除应用程序 停止服务器 从webapps中删除应用文件夹 从服务器中的临时文件夹中删除内容 从服务器中的工作文件夹中删除内容 在Eclipse上重新打开应用程序 启动服务器

可能有些步骤是不需要的,但“以防万一”。

因此,如果前面的解决方案仍然不适合你。试试这个。 我希望这对你有所帮助;-)

其他回答

如果您确实指出了您正在使用的eclipse版本和技术(例如,Java JDT,或面向Java的AJDT,或c++ CDT),这将有所帮助。

在Java方面,我猜想您的“勾选编译器选项中的复选框”指的就是这个

在“窗口—>首选项—> Java—>编译器—>类文件生成”下,所有“类文件”生成选项都设置为True:

(1)添加可变属性, (2) addline number, (3)添加源文件名, (4)保存未使用的局部变量。

您的项目是否只在全局级别(windows Preferences)或在项目特定级别检查这些?

你确定打开的类(你试图在上面设置断点):

是您的源代码之一(并且不是来自第三方库) 是。java,而不是。class?

尝试清理所有内容并重新构建所有内容,检查潜在的jar冲突。

不知道这是否仍然相关,也许另一个水手会发现这有用。

当已编译的类文件关闭调试标志时,将出现该消息。

在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

尝试更改您使用的jre。请设置JDK目录下的jre。

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

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.