Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Source code for Mac OS X Java Updates [duplicate]

Tags:

java

macos

Java for Mac OS X 10.6 Update 3 upgraded to java 1.6.0_22. However, they did not include the source code or JavaDoc. Does anyone know if Apple provides the source, and if so, where to find it?

I'd like to attach the source to Eclipse.

like image 837
curthipster Avatar asked Nov 07 '10 22:11

curthipster


People also ask

Can I have multiple java versions installed on Mac?

The cleanest way to manage multiple java versions on Mac is to use Homebrew . And within Homebrew , use: homebrew-cask to install the versions of java. jenv to manage the installed versions of java.

How do I find java path on Mac?

In macOS, the JDK installation path is /Library/Java/JavaVirtualMachines/jdk-10. jdk/Contents/Home . The root directory of the JDK software installation.

How do I change the version of java on my Mac?

Switch Java JDK via alias Setup your JAVA_HOME path in your . zshrc or . bash_profile for your primary Java version and add an export for each installed Java version. Add an alias to your .


2 Answers

I had the same problem today - I installed the Java Developer package from http://connect.apple.com, but couldn't find "src.jar" in /System/Library/Frameworks/JavaVM.framework/... anymore. On my machine, it's now in
/Library/Java/JavaVirtualMachines/1.6.0_22-b04-307.jdk/Contents/Home/src.jar.

Update: For the latest version from March 2011, the jar is now:
/Library/Java/JavaVirtualMachines/1.6.0_24-b07-334.jdk/Contents/Home/src.jar

Once again, you'll have to download the new Java Developer package first.

like image 97
Chris Lercher Avatar answered Sep 21 '22 13:09

Chris Lercher


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.

like image 28
Steve Powell Avatar answered Sep 25 '22 13:09

Steve Powell