1

Can we not put a breakpoint in the classes in rt.jar?

I am debugging something and I need to put a breakpoint in java.sql.DriverManager, but as soon as I put a breakpoint at some place, eclipse prompts me with the message

Unable to install breakpoint in java.sql.DriverManager due to missing line number attributes. Modify compiler options to generate line number attributes

Does this mean that java runtime classes were not compiled for debugging? If yes, then why would such a thing be done. Please help!

Edit1: I am doing remote debugging, the actual web application is running in tomcat on a linux machine, I am on a windows machine. Which rt.jar is the culprit here, the one on my machine or the one on remote machine? And is it possible that rt.jar is not compiled with line numbers and other useful info?

Edit2: The answers to this question has the details Locally declared variables can not be inspected Anyone knows why this is compiled without debugging symbols? How does it affect the performance to keep some metadata or is it something else?

Community
  • 1
  • 1
Ashish
  • 3,028
  • 5
  • 28
  • 35
  • netbeans 7.1, jdk 1.6.30, win7, having no problem setting break point for the DriverManager class – Dapeng Feb 09 '12 at 09:49
  • 1
    In the past rt.jar with debug symbols was downloadable from java.net. But now i can't find any track of it. – lxbndr Feb 09 '12 at 10:50

2 Answers2

3

If a class is not compiled with the debug switch (-g) you are not able to set breakpoints on a specific line.

However, you can still set breakpoints on methods (in eclipse: set breakpoint on the first line which defines the method) even if the classes are not compiled for debugging.

It is most likely you will not have access to local variables and you are not seeing in which line you step through the code. This makes debugging a little bit harder, but you are able to still see what's going on (e.g. examine the method argument values), especially if you know the underlying source code.

But I am wondering that your rt.jar is not compiled with debugging information.

MRalwasser
  • 15,605
  • 15
  • 101
  • 147
0

Thats an eclipse setting. As clear by error message too 2nd Option checked in Classfiel Generation

Go to Preference 2nd Option checked in Classfiel Generation

manocha_ak
  • 904
  • 7
  • 19
  • yeah, but my question was...isn't rt.jar compiled with these settings? – Ashish Feb 09 '12 at 10:43
  • 1
    Ohh i missed the last line of yours... and plus with my jdk 1.6.0 I am always able to debug inside rt.jar too. sorry for not paying much attention. It boils down to specific class being compiled taht wasy only. – manocha_ak Feb 09 '12 at 11:02
  • are u able to debug inside DriverManager too? Is it because of remote debugging that I am having this problem? – Ashish Feb 09 '12 at 14:58