天天看点

java断点找错,在Eclipse中进行调试时,如何解决断点错误?

java断点找错,在Eclipse中进行调试时,如何解决断点错误?

Need to debug a JAR file "ProA", so import the source code in the project,

but there is a strange error in Eclipse while trying to set a breakpoint.

Detail as below:

Unable to install breakpoint due to missing line number attributes.

Modify compiler options to generate line number attributes.

I have try to several method to solve, but failed.

Under Window > Preferences: Java > Compiler > Classfile Generation, all options have to be to True

In .settings folder of your project, look for a file called org.eclipse.jdt.core.prefs. Verify or set org.eclipse.jdt.core.compiler.debug.lineNumber=generate

Add the debug=true flag in the build.xml, just like this:

Any help will be appreciated.

解决方案

I have had the same problem, but reading your post helped me resolve mine. I changed org.eclipse.jdt.core.prefs as follow:

BEFORE:

eclipse.preferences.version=1

org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled

org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7

org.eclipse.jdt.core.compiler.compliance=1.7

org.eclipse.jdt.core.compiler.problem.assertIdentifier=error

org.eclipse.jdt.core.compiler.problem.enumIdentifier=error

org.eclipse.jdt.core.compiler.source=1.7

AFTER:

eclipse.preferences.version=1

org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled

org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7

org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve

org.eclipse.jdt.core.compiler.compliance=1.7

org.eclipse.jdt.core.compiler.debug.lineNumber=generate

org.eclipse.jdt.core.compiler.debug.localVariable=generate

org.eclipse.jdt.core.compiler.debug.sourceFile=generate

org.eclipse.jdt.core.compiler.problem.assertIdentifier=error

org.eclipse.jdt.core.compiler.problem.enumIdentifier=error

org.eclipse.jdt.core.compiler.source=1.7

Another way to modify these options within the Project> Properties> Java Compiler. So, there is no need to modify manually the org.eclipse.jdt.core.prefs file. There you need to make sure that the Classfile Generation options are checked.