Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes IDEs, Version Control and other tools and the fly likes debugging java hashmap source code using eclipse Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "debugging java hashmap source code using eclipse" Watch "debugging java hashmap source code using eclipse" New topic

debugging java hashmap source code using eclipse

satish bodas
Ranch Hand

Joined: Jun 19, 2008
Posts: 116
Hello ,
earlier had asked a question regarding load factor in Hahmap

In order to do some work on my own ( and not just ask without trying ! ) I tried setting up an eclipse project and in a method defined a HashMap.
When I hit F3 on my keyboard - eclipse specified that "Source not found"
"File rt.jar has no source " and a button with ::
"Attach source "

In my jdk I see a archive file "F:\jdk1.5.0_15\"
which is what I attached

Now I can see the source of the HashMap in eclipse

My problem being ::
I tried putting a breakpoint in the code of HashMap
and then run eclipse in debug mode

I get the following error :

Looked up google and see that one option specified is ::
This property " Add line number attributes to generated class files "
needs to be set

This property is enabled .
Checked via :: Window >> preferences >>Compiler
and also ::
Project >> Properties >> set to true here ( cant change in this view )

So can someone please tell me how to run Java collection code in debug mode in eclipse ?

This may not be the right forum but wastnt sure where to post it .

Thanks ,
Rob Spoor

Joined: Oct 27, 2005
Posts: 19651

Eclipse specific problem. Moving to IDEs.

How To Ask Questions How To Answer Questions
Ilja Preuss

Joined: Jul 11, 2001
Posts: 14112
The compiler option will only affect how your classes are compiled. The HashMap class already comes compiled with the JDK, so what matters here is how *Sun* compiled the JDK.

Make sure that under "installed JREs", you are using the JDK, not an JRE. Eclipse should pick up the sources automatically for you, and you shouldn't have any problems with line numbers any more.

The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
satish bodas
Ranch Hand

Joined: Jun 19, 2008
Posts: 116
Thanks Ilja for the help .
Now I am able to debug the source code of Java .
While debugging I was getting a error of the type ::
" sun.misc.launcher not found " - attach source

I didnt attach any source but after some time this error went off

Not sure why - but thanks I am now able to debug code

Consider Paul's rocket mass heater.
subject: debugging java hashmap source code using eclipse
Similar Threads
Debugging Help
Eclipse debug not finding the code block
Eclipse 3.2 (WTP) : Error occuring while trying to debug
Debugging a web application in Eclipse
How to debug using Eclipse?