This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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 .
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
Joined: Jun 19, 2008
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