Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to install a JDK 8 on OS X Mountain Lion (to experiment with the new lambda features).

Starting point

A machine recently updated from OS X 10.6 to 10.8, with

$ sw_vers
  ProductName:    Mac OS X
  ProductVersion: 10.8.2
  BuildVersion:   12C60

$ ls -l /Library/Java/JavaVirtualMachines/
  Home@ -> jdk1.7.0_09.jdk/Contents/Home/

$ ls -l /System/Library/Java/JavaVirtualMachines/

and this folder from the OS X 10.6 era:


In ~/.bashrc I've set

export JAVA_HOME=/Library/Java/JavaVirtualMachines/Home

So I have

$ java -version
  java version "1.7.0_09"
  Java(TM) SE Runtime Environment (build 1.7.0_09-b05)
  Java HotSpot(TM) 64-Bit Server VM (build 23.5-b02, mixed mode)

$ /usr/libexec/java_home

How I installed JDK 8

  1. Downloaded the .tar.gz file from and unpacked it into

    • /Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home

    (I created the folders jdk1.8.0.jdk/Contents/Home manually)

  2. Changed the symlink /Library/Java/JavaVirtualMachines/Home to point to jdk1.8

Now I have

$ java -version
  openjdk version "1.8.0-ea"
  OpenJDK Runtime Environment (build 1.8.0-ea-lambda-nightly-h2135-20121203-b67-b00)
  OpenJDK 64-Bit Server VM (build 25.0-b05, mixed mode)

$ echo $JAVA_HOME

$ ls /Library/Java/JavaVirtualMachines
  Home@ -> jdk1.8.0.jdk/Contents/Home/

But the java_home utility doesn't seem to care:

$ /usr/libexec/java_home 

It doesn't even know that there is a JDK 8 available:

$ /usr/libexec/java_home -v 1.8*
  Unable to find any JVMs matching version "1.8*".


I'd like the /usr/libexec/java_home utility to find my installed JDKs, so I can use something like this:

alias setjdk17='export JAVA_HOME=$(/usr/libexec/java_home -v 1.7*)'
alias setjdk18='export JAVA_HOME=$(/usr/libexec/java_home -v 1.8*)'

and get rid of the Home symlink. Does anyone know

  • how I can properly install JDK 8?
  • how I can make /usr/libexec/java_home recognize it?
share|improve this question

You need to also copy the Contents/MacOS directory and Info.plist from the 1.7 SDK and adapt them (by changing the version strings in it).

Then you can:

$ export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home
$ java -version
openjdk version "1.8.0-ea"
$ /usr/libexec/java_home -v 1.8*

Note that this is a hack and I didn't try anything else than start java... I was just building on your tip of creating the package.

share|improve this answer
Thanks for your reply, Anjo. I'll give it a try as soon as I fixed my OS X 10.8 system (which is now broken: […). – Tikus Kucing Mar 25 '13 at 8:34

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.