What I do is as follows:
Download and install the Java Developer Kit (using your developer AppleId), current version 1.6.0_24-b07-334.jdk
, and then in a shell, cd to the /System/Library/Frameworks/JavaVM.framework/Home
directory.
Put in symbolic links to the jdk source files, src.jar
, docs.jar
and appledocs.jar
, in the jdk you've just downloaded, that is:
sudo ln -s /Library/Java/JavaVirtualMachines/1.6.0_24-b07-334.jdk/Contents/Home/src.jar src.jar
and similarly for the other two jars.
Then, in Eclipse/Preferences, you can create a new Installed JRE by duplicating the existing one (the existing one points to something like /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
) and then select the new Installed JRE and remove the original.
The Eclipse Projects might need updating to point to the 'new' JRE, but the source and javadocs should now be available for the standard java stuff without further ado.
NB Ensure that the version of the jdk matches the version of your system Java for this to work properly.