Java/Eclipse on MacOSX: where is the src.zip?

Viewed 26401

With the latest Java update on MacOSX 10.6, Eclipse does not find the Java sources anymore.

I am not exactly sure (i.e. don't remember anymore) if I have downloaded the sources manually in the past and put them somewhere or if MacOSX provided them and Eclipse found them automatically.

Does MacOSX have the sources somewhere? (Please no assumptions here. I really want to know that.)

If not, where can I get them?

13 Answers

Thanks to folks that have previously provided answers; they've been helpful.

As a newb to Mac (10.6.6), here's what I did for MyEclipse, which should also work for Eclipse; I've not tested this in a disconnected mode. When trying to add another JRE for MyEclipse 8.5, it required a "MacOS X VM", and would not support a "Standard VM". I tried modifying both the eclipse.ini and myeclipse.ini files, and also tried starting MyEclipse from the command line with a specific JAVA_HOME set with no avail.

1) download and install the correct Java Developer Package. Go to System Preferences -> Software Update -> Installed Software. You may have multiple versions of a given installation, in my case, I had both "Java for Mac OS X 10.6 Update 2" and "Java for Mac OS X 10.6 Update 3" - so be sure to sort by name, or verify some other way. As of today, the downloaded file name was javadeveloper_10.6_10m3261.dmg.

2) In a terminal window, I added some symlinks from the OS VM that point to jars in the Standard VM. I have slightly modified security permissions, so you may or may not need to use sudo to create the symlinks.

cd /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
sudo ln -s /Library/Java/JavaVirtualMachines/1.6.0_22-b04-307.jdk/Contents/Home/appledocs.jar
sudo ln -s /Library/Java/JavaVirtualMachines/1.6.0_22-b04-307.jdk/Contents/Home/docs.jar
sudo ln -s /Library/Java/JavaVirtualMachines/1.6.0_22-b04-307.jdk/Contents/Home/src.jar

Just found the src.zip on my mac at /Library/Java/JavaVirtualMachine/adoptopenjdk-11.jdk/Contents/Home/lib/src.zip

Adding to 'project structure - SDKs - Sourcepath' allowed me to view java source files in IntelliJ...

Related