views:

4583

answers:

5

I am getting this strange error in Eclipse while trying to set a breakpoint.

Unable to insert breakpoint Absent Line Number Information

Ticked the checkbox from Compiler options but no luck.

Thanks

+1  A: 

It would help if you did indicate the version of eclipse you are using and the technology (Java JDT, or AJDT for Aspect Java, or C++ CDT for instance), just to be sure.

On the Java side, I suppose your "Ticked the checkbox from Compiler options" refers to this

Under "Window --> Preferences --> Java --> Compiler --> Classfile Generation", all 'Class file' generation options are set to True:

  • (1) add variable attributes,
  • (2) addline numbers,
  • (3) add source file name,
  • (4) preserve unused local variables.

Does your project has those checked only at global level (widows Preferences) or at project specific level ?

And are you sure the class opened (on which you try to set a breakpoint):

  • is one of your sources (and not coming from a third party library)
  • is a .java, not a .class ?

Try to clean everything and rebuild all, check for potential jar conflicts.

VonC
chandrajeet
@chandrajeet if you have those settings set globally, I supposed you checked your project does not override them with project specific settings ? If not, the only thing I see right now is to put breakpoints on .class instead of .java...
VonC
A: 
  1. In eclipse menu, go to Window->Preferences->Java->Compiler
  2. Unmark checkbox "Add line number attributes..."
  3. Click Apply -> Yes
  4. Mark checkbox "Add line number attribute..."
  5. Apply again.
  6. Go happy debuging

trail

+7  A: 

I had the same error message in Eclipse 3.4.1, SUN JVM1.6.0_07 connected to Tomcat 6.0 (running in debug-mode on a different machine, Sun JVM1.6.0_16, the debug connection did work correctly).

Window --> Preferences --> Java --> Compiler --> Classfile Generation: "add line number attributes to generated class file" was checked. I did a clean, recompile. I did uncheck it, recompile, check it, recompile. I made sure the project did use the global settings. Still the same message.

I switched to ant build, using

<javac srcdir="./src/java" destdir="./bin" debug="true">

Still, same message.

I didn't find out what caused this message and why it wouldn't go away. Though it seemed to have something to do with the running Tomcat debug session: when disconnected, recompiling solves the issue. But on connecting the debugger to Tomcat or on setting new breakpoints during a connected debug session, it appeared again.

However, it turned out the message was wrong: I was indeed able to debug and set breakpoints, both before and during debugging (javap -l did show line numbers, too). So just ignore it :)

Zefiro
Same thing happened to me, eclipse gives an error but the debugger stops on the breakpoint.
Nash0
me too, what a waste of my life! I just spent hours trying to figure out what was wrong. grrr. Should have come to SO first... thanks for posting this answer +1
Simon
Same issue here - thx a lot man!
david
A: 

I had this problem while attempting to start Tomcat in debugging mode from Eclipse. I had an ANT build file taking care of the compile and deploy. After setting the debug flag to true (as mentioned in other answers) and redeploying the application it worked fine:

<javac srcdir="./src/java" destdir="./bin" debug="true">

NOTE: if you've just added the debug flag and recompiled you still need to redeploy your application to the server since this is where Eclipse is debugging the class files. Very obvious but easy to spend an hour or so scratching your head and wondering why it's not working (trust me).

chrisjleu
A: 

I had this same problem when debugging a WAR (constructed from multiple Eclipse project artifacts) deployed to Tomcat.

I am building everything using an ANT build script. If this is what you are doing, make sure that the debug=true flag is set on every javac ant task you've got. This was my only problem - I hope it helps your problem!

ubermensch