Unable to install breakpoint due to missing line number attributes

Unable to install break points in eclipse.
This is a very common error with eclipse. When you try to set a break point, eclipse says “unable to install breakpoint due to missing line number attributes”.

Description of the error

Can not set the break point. A dialog box appears with the error message like

Unable to install breakpoint in xyz class due to missing line number attributes. modify compiler options to generate line number attributes.

Reason: Absent line number attributes in generated class file.

Solution
Follow this steps if you are compiling classes using eclipse

1. If you are compiling using the eclipse. Verify the class file generation options.

Go to windows > preferences > Java > compiler screen.

Make sure that add line number attributes to generated files (used by debugger) check box is checked.

If you don’t know, what other options are. Check all other three check boxes also.

Eclipse - preferences
Eclipse - preferences

Follow this steps if you are compiling using ANT

Look into the build file and make sure that debug attribute is set to true in javac task

<javac  debug=”true” srcdir=”” destdir=””>

Set debug=”true” and build again.

<javac srcdir=””  destdir=”” verbose=”false” debug=”true” debuglevel=”lines,vars,source”>

That’s it !! Try setting the break point again.

20 thoughts on “Unable to install breakpoint due to missing line number attributes

  1. Hi,

    I am fine setting breakpoints in my own code.

    Howevere, I want to put a breakpoint in java.lang.System setProperty() method
    and I get this same error.

    Any ideas ?
    Thx.

  2. Hi there,

    I had the same problem when I tried to set a breakpoint in java.net.DatagramSocket.

    What I foudn wrong in my setup is, that I had the wrong src.zip attached.

    To ensure, you have the correct src.zip, do this:
    Window->Preferences->Java->Installed JREs
    Select your JRE and click “Edit”.
    On the “Edit JRE” screen select the entry for rt.jar and click “Source Attachment”
    Make sure, your src.zip location is correct/present.

    For me I used as JRE C:\Program Files\Java\jdk1.6.0_04\jre and with that my source attachment was in C:\Program Files\Java\jdk1.6.0_04\src.zip.

    I had previously been pointing at a wrong version of src.zip (wrong path, wrong JDK)

    Hope this helps!

  3. I am having the same problem in my code even though I have checked like it is in the picture. This only happens for one of my apps. DEBUG works for the rest.

    ?

    1. Hi I user maven for building my web application and I too seem to experience the same problem. Please let me know if you were able to get it working.
      Thanks

  4. Hi there,

    your comment on adding the entry debug=”true” to the Ant build file solved it for me. Thank you very much, great post !

    Regards
    Robert

  5. FINALLY!!!!!
    after sooooooooooo many months I have been able to debug my .java files using ant..
    all thanks to ur post 🙂

  6. hi,

    I have done the above. I am not compiling using ant but I am still getting the same issues. Can you please help me on the same. I am using eclipse galileo and oepe plugin for my weblogic integration.

    Regards,
    Acharya

  7. The works for me! Like to thank Snimavat. I was using Fitnesse browser test that talks to port 1044 of Eclipse RemoteDebug. I recompiled and deploy after setting the debug=”true” and it lighted up. This is after 1 whole day of hacking when i gave up and google instead.

  8. I am using Ant to build, with debug=”yes”, Glassfish App sever with multiple domains,But, deployed application on one domain. Using Eclipse Helios Service Pack 2,Windows 7.

    I checked
    Window->Preferences->Java->Installed JREs
    and
    Window->Preferences->Java->Compiler
    and
    clean builds-Many times
    and
    Exit Eclipse, Restart Machine-Many times
    and
    eclipse plugin cleaning

    But, no use.

    I get following error when I try to debug from IDE or Remote Debugging.

    “Unable to install breakpoint in xyz class due to missing line number attributes. modify compiler options to generate line number attributes.”

    Following is my EclipseConfiguration Settings

    -startup
    plugins/org.eclipse.equinox.launcher_1.1.1.R36x_v20101122_1400.jar
    –launcher.library
    plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.2.R36x_v20101222
    -product
    org.eclipse.epp.package.jee.product
    –launcher.defaultAction
    openFile
    –launcher.XXMaxPermSize
    256M
    -showsplash
    org.eclipse.platform
    –launcher.XXMaxPermSize
    256m
    –launcher.defaultAction
    openFile
    -vmargs
    -Dosgi.requiredJavaVersion=1.5
    -Xms256m
    -Xmx1024m

    Any help is appreciated.

  9. Thanks for the post. Even after doing all this, I was still facing same issue. On further investigating, I found that the build path of the main method project had reference to jar file and the source files, the order of included jar file was before the source files. So, eclipse was looking for classes with line number inside the class files of the jar and not that of the source.
    Bottom line: If above steps doesn’t work, then recheck the build path to make sure debugger is looking for eclipse generated class file.

  10. Thanks a lot for the information.If the above solution didn’t work ,check your Build.xml javac debug parameter,the debug value should be on. as given below.

  11. Thanks a lot for this valuable information.i also faced the same problem and after modifying the Ant file it’s works

    Many thanks

Leave a reply to J Cancel reply