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


7 thoughts on “JAVA_HOME on OS X Lion

  1. 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.

Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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