I didn’t find any clear instructions on upgrading the JDK on OS X so I thought I’d share my findings.
First off, apparently Software Update does not automatically update the JDK. You have to manually download and run the updates. There are four updates to “Java for Mac OS X 1.5″. Since I couldn’t tell whether they were cumulative or not, I just downloaded and installed each one in sequence:
Now you’d think you’d be done, but those updates only install JDK 1.6—they don’t make it the default. The way I did that was to change a link in the Framework:
cd /System/Library/Frameworks/JavaVM.framework/Versions
sudo rm -fr CurrentJDK
sudo ln -s 1.6 CurrentJDK
Now I see:
$ java -version
java version "1.6.0_13"
Java(TM) SE Runtime Environment (build 1.6.0_13-b03-211)
Java HotSpot(TM) 64-Bit Server VM (build 11.3-b02-83, mixed mode)
Now to see if it really works…
Update 1 8/7/09: That link I created wasn’t quite right in the original post. It was creating a link with an absolute path. This apparently caused the Java Preferences app to fail to start and also caused WebKit/Safari to crash on all but the simplest web pages. Wierd. Corrected link creation above.
I have JDK 6 without downloading any updates. All came automatically.
I don’t know why you change default java with those sudo commands. You can run Java Preferences from Applications/Tools. There you can see all versions and you can change the order.
So glad that you posted this. I have been wanting to update to Java 1.6 but was always reading that on OS X you could only do it via running Software Update. 1.6 Update never showed up so I figured there was no way of doing in.
This will really help me out a lot. Thanks again!
I did change the Java environment using Java Preferences but as far as I could tell, doing so only changed the Java version used by the browsers (plugins). It did not apparently change the version of the command line tools e.g. java, javac.
Um, I do notice now that Java Preferences will not run on my system. Doh.
thank you for sharing this, it help me fix this same issue on my machine
Pingback: Migrating to Java 1.6 (Warning: Flex Builder/Eclipse wont work with it) | code zen
Different ways to do things (OS X 10.5.8)- I opened the Applications/Utilities/Java Preferences.app, left the Java Applet Plugin as I found it due to comments regarding web browsers being affected. Under Java Applications I dragged the Java SE 6 64-bit (which was present) to the top of the list and then re-attempted installing my JDK 1.6 dependent application. It worked with no additional steps.
re: previous post (OS X 10.5.8) – while executing java -version resulted in response of 1.6.0_15, the CurrentJDK link had to be changed as indicated in your instructions. Doing that broke Safari but Applications/Utilities/Java Preferences still worked. To fix the Safari issue, I changed my Java Applet Plugin by dragging Java SE 6 64-bit to the top of the list, followed by J2SE 5.0 64-bit, J2SE 5.0 32-bit, etc. I have learned from this post and hope this helps others.
Pingback: Upgrade MacOSX Java JDK to 1.6 « Christoph Jerolimov
I’m afraid your links are no longer valid – apple seem to be changing things on their website constantly.
Any idea where we can get those files now?
This is one place where windows and lynux excel over the mac. Change java version or mysql version or svn version what a pain in the ass.
Re post from Brian Trimble above, I tried this and it worked perfectly. I simply dragged Java 1.6 to the top of the list in Java Preferences (Applications/Utilites) and tried starting the Java app that was complaining. It started with no problems.
I thought this was to be the end of my pain (I am trying to upgrade my OS X 10.5.8 to JDK 1.6).. but the 4 update links seem to get point to something else (or, am I mistaken?). I tried the first one, downloaded it, but it appeared the linked file was for OS X 10.6…
Could anybody please provide the correct links for upgrading to JDK 1.6 (as I found, OSX matters… it’s 10.5.8)?
I´ve downloaded the update from http://www.macupdate.com/app/mac/13295/apple-java-for-mac-os-x-10.5
Then reset the Current as you wrote & it worked.
Thanks!!!
Huh. My computer might be wonky, but each of the links sends me to the support downloads page of the mac store, and there are a lot of those. which one is it?
Well @Dirtyowlnumber4, apparently the links have changed. I don’t know where the JDK updates moved to.