After updating to the latest (and now deprecated, sniff...) update of Apple's JDK, Eclipse does not show the source code for JDK classes anymore. It asks me to attach the source location file or folder. Where can I find that?
5 Answers
It seems that Java for Mac OS X 10.6 Update 3 does not include the sources anymore. There is a separate package "Java for Mac OS X 10.6 Update 3 Developer Package" now. See http://lookfirst.com/2010/10/how-to-fix-missing-source-for-latest.html

- 10,536
- 3
- 32
- 59
-
A free 139MB download, but requires registration with the Apple Developer Connection (also free). – Thilo Nov 15 '10 at 11:44
-
@Thilo the latest download (JDK 1.6u6) is a mere 134 MB! – Matt Ball Dec 03 '11 at 00:20
For each update from Apple, I write a new blog post with the updated symlinks. I noticed a lot of traffic on my blog from one of the answers, so I figured I might as well update things with the latest release.
I could write a simple shell script to do this for you, but that would require you to download a file. Seems simpler to just execute a few easy commands.
This is the latest one for update 5:
http://lookfirst.com/2011/06/fix-missing-source-for-java-mac-os-x.html

- 1,817
- 1
- 21
- 20
-
Thanks. Another good thing related to this would be to find proper release notes about what has changed. The tech note from Apple is completely non-informative. – Thilo Jul 06 '11 at 08:18
-
Good luck with that. Apple is rarely very informative with that information. – Public Profile Jul 06 '11 at 22:32
I am using Mac OS 10.8.5. I downloaded the java for Mac OS 10.7 and installed it. I found the src.jar
file in
/Library/Java/JavaVirtualMachines/1.6.0_37-b06-434.jdk/Contents/Home/src.jar.
Then I
- Opened eclipse(JUNO)
- Eclipse > Prefereces > JAVA > Installed jre
- Edit the java listed
In the jre system libraries section,
- Expand the first one (i.e., classes.jar)
- You can see that src is not attached
- Double click that and provide the above location
That's it.

- 5,409
- 8
- 49
- 55

- 31
- 1
In my case the sources are in
/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/src.jar
You might need to set this in the Eclipse preferences: Java - installed JREs. Select the 1.6 JVM and click edit. Now select classes.jar from the list of JRE system libraries, click source attachment and enter the path to your src.jar.

- 10,536
- 3
- 32
- 59
-
I don't have src.jar. What OS version are you using, and did you run the latest Java software update? Did that take src.jar away? I definitely had sources attached in Eclipse before (and by default, I think). – Thilo Nov 03 '10 at 01:15
-
I'm on OSX 10.6.4 and I did not run the latest Java update. That is I'm on java version "1.6.0_20". It might well be that the update takes src.jar away. An earlier update uninstalled java 1.5 and some of my Maven versions. – michid Nov 03 '10 at 10:06
-
1Every JRE update does take src.jar away. When I updated to 1.6.0_26 from 1.6.0_24 I had to got to developer.apple.com/downloads and download the JDK again to get the source. – David G Oct 26 '11 at 18:00
To all the guys who's been suffering from searching the source code here and there for hours but finally get nothing.
For Eclipse to attach(imperfectly available for 1.6): jdk1.7.0_21_src_for_mac.zip

- 2,496
- 1
- 27
- 41