JAVA_HOME on OS X Lion

If you currently have your JAVA_HOME environment variable set as the trusty:

export JAVA_HOME=/Library/Java/Home

then when you upgrade to Lion you will need to adjust it, as the install location has changed. The new environment variable should be:

export JAVA_HOME=$(/usr/libexec/java_home)

This is actually a command which (in true OS X Java fashion) is a symlink to another command that outputs the true location of Java. For example:

[iMac:~]$ /usr/libexec/java_home
/Library/Java/JavaVirtualMachines/1.6.0_26-b03-383.jdk/Contents/Home

This entry was posted in apple, java, sakai, uportal. Bookmark the permalink.

5 Responses to JAVA_HOME on OS X Lion

  1. Pingback: Setting JAVA_HOME on OSX lion » Enterprise Search, System Administration, and Cloud Computing

  2. Thanks so much! This got me back up and running after my upgrade.

  3. Steve says:

    Many thanks; I was wondering about this.

  4. Turns out that depending on how you install the JDK, the /Library/Java/Home link still works. If you install it manually, you need to do as the article says, if you launch a Java command and install it via the prompt that comes up, the link in this comment works. Nice and consistent.

  5. Prem says:

    Thanks Steve, this worked well for me on Snow Leopard too. Seems to be a more robust approach.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s