Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

debugging java hashmap source code using eclipse

 
satish bodas
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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\src.zip"
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 ,
~satish
 
Rob Spoor
Sheriff
Pie
Posts: 20527
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Eclipse specific problem. Moving to IDEs.
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
satish bodas
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

~satish
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic