tags:

views:

1497

answers:

3

I cannot for the life of me attach the java source code to eclipse so I can see the inner workings of the language. Not even something as simple as the String Class.

when I run java -version this is what I have:

java version "1.6.0_14"
Java(TM) SE Runtime Environment (build 1.6.0_14-b08)
Java HotSpot(TM) Client VM (build 14.0-b16, mixed mode, sharing)

I am downloading the java souce from: http://download.java.net/jdk6/source/

And in eclipse when I attach it It says:

The JAR file "C:\Program Files\Java\jre6\jdk-6u14-fcs-src-b08-jrl-21_may_2009.jar" 
has no source attachment.

What am I doing wrong?

+6  A: 
VonC
E:\Program Files\Java\jre6 -> Java HomeE:\Sun\SDK\jdk -> Path VariableI have these two folders. Which one should I point to what?!?Is there a difference between the JDK and SDK? I because I did a search on my computer and I can't find src.zip.I have rt.jar in both folder but I don't know what to do with it...
hello_world_infinity
Under XP I have never seen Eclipse picking up the JDK - only the public JRE installed with it.
Thorbjørn Ravn Andersen
@ Thorbjørn Ravn Andersen : eclipse will detect it if you specify the vm to use when launching Eclipse in the eclipse.ini
VonC
+2  A: 

The easiest way to do this, is to install a JDK and tell Eclipse to use it as the default JRE. Use the default install.

(from memory)

Open Window -> Prefences. Select Installed Java runtimes, and choose Add. Navigate to root of your JDK (\Programs...\Java) and click Ok. Then select it to be the default JRE (checkmark).

After a workspace rebuild, you should have source attached to all JRE classes.

Thorbjørn Ravn Andersen
A: 

Windows JDK has a "src.zip" but in linux (ubuntu) I can't see the src.zip Does anybody knows?

Alfonso
Welcome to SO, Alfonso! Please post this as a new question so we can keep things organized. Thanks!
ZoogieZork