Ashish
Ashish

Reputation: 3060

Breakpoint in java runtime libraries (rt.jar)

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?

Upvotes: 1

Views: 2430

Answers (2)

manocha_ak
manocha_ak

Reputation: 902

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

Upvotes: 0

MRalwasser
MRalwasser

Reputation: 15953

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.

Upvotes: 3

Related Questions