Wednesday, April 8, 2009

Enabling Java 1.6 for Mac OS X

OK, I might be the last Java developer using a Mac to realize this, but apparently Mac OS X 1.5 (Tiger) uses J2SE 5.0 by default, even though Java SE 6 has been available for nearly two years.

I figured this out today while reading Google's instructions on how to create Java applications for App Engine. (Side note: Woot!) The section regarding compatibility with different versions of Java contained this curious sentence:
For developers that don't have easy access to Java 6 (such as developers using Mac OS X), the App Engine SDK is compatible with Java 5.
That was a head-scratcher. I know that Apple's support for Java usually lags Sun's releases for Windows/Solaris/Linux by a few months, but Java 6 was released over two years ago. Surely Apple has caught up by now, right? To the Terminal window!
Hank:~ mtye$ java -version
java version "1.5.0_16"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_16-b06-284)
Java HotSpot(TM) Client VM (build 1.5.0_16-133, mixed mode, sharing)

Huh. That can't be right, can it? No, a little poking around on Apple's site reveals that Java SE 6 was pushed out to users with Java for Mac OS X 10.5 Update 1, back in May 2008. So where's my Java 6?

I found a crucial clue here. Apparently, in the /Applications/Utilities/Java directory, there's a Java Preferences application that can be used to determine which Java version is used by default. I fired it up and got this:

Oh, there's Java 6! Right behind the 32-bit version of Java 5, for some reason. Let's fix that with a little drag & drop:

Let's check again:
Hank:~ mtye$ java -version
java version "1.6.0_07"
Java(TM) SE Runtime Environment (build 1.6.0_07-b06-153)
Java HotSpot(TM) 64-Bit Server VM (build 1.6.0_07-b06-57, mixed mode)
Ah, that's much better. I feel so 2007 now!


  1. Thanks a lot. I am impressed that some programs could not find the v1.6

  2. Thanks buddy! I thought, I was doomed but you saved me :)

  3. You said "Mac OS X 1.5 (Tiger) uses J2SE "

    Mac OS X 10.4 is Tiger

    Mac OS X 10.5 is Leopard

    Mac OS X 10.6 is Snow Leopard

    The BIG question is if 10.4 Tiger can run Java 1.6. Do you know?

  4. Thanks. That was VERY helpful. Gotta wonder why mac does that.

  5. extremely bummed to find out i cant run se 6 on my powerbook g4

  6. This didn't work for me, after performing this change in Utilities I still had
    $ java -version
    java version "1.5.0_30"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_30-b03-389-9M3425)
    Java HotSpot(TM) Client VM (build 1.5.0_30-161, mixed mode, sharing)

    I noted that /usr/bin/java was a symlink

    $ ls -ld ` which java `
    lrwxr-xr-x 1 root wheel 74 Jul 16 2011 /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java

    So I reset it as below

    cd /System/Library/Frameworks/JavaVM.framework/Versions
    sudo mv Current Current.old
    sudo mv CurrentJDK CurrentJDK.old
    sudo ln -s 1.6 CurrentJDK
    sudo ln -s 1.6 Current

    That worked fine.

  7. Good post.You shared very nice information. Thanks for sharing.
    primary school website design

  8. We are offering website and website design for your company website and or your own website.........

    App Buzz

  9. Java Online Training Java Online Training Java Online Training Java Online Training Java Online Training Java Online Training

    Hibernate Online Training Hibernate Online Training Spring Online Training Spring Online Training Spring Batch Training Online Spring Batch Training Online