Through this series we see how to install Java. In this article, we will look specifically at installing on Mac OS X.

Java 6 JDK

Until Mac OS X 10.7, Java was installed by default. For Mac OS X 10.7, Java can be downloaded from

The JAVA_HOME environment variable should be set to /Library/Java/Home. You can set it by adding the following to /etc/launchd.conf:


setenv JAVA_HOME /Library/Java/Home

See our article, HowTo: Set an Environment Variable in Mac OS X for other ways to set the environment variable.

Java 7 JDK

Java 7 can be installed by downloading it from Oracle. Download

If you have both the Apple and Oracle JDKs installed, make sure to go to /Applications/Utilities and open Java Preferences to select which version of the JDK to use.

Parts of this series