Install JDK on Mac OS X

The purpose of this section is to guide you to install Java in your development environment. JDK is a shortcut for Java™ Platform, Standard Edition Development Kit

The JDK is a development environment for building applications, applets, and components using the Java programming language.

Latest version of JDK is JDK 8.

JDK 8 installation is mandatory if you want to target Android devices.

Navigate to the following URL :

Locate the button Java SE Downloads:

Click on this button.

On the next page select the latest release for the Mac OS X platform: jdk-8u112-macosx-x64.dmg.

Install the package.

Setup the JAVA_HOME system variable

Open the Terminal app and type the following command:

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

To check the JAVA_HOME is correctly setup type the following commands:


You should see the following result:

COPYRIGHT                include
README.html                jre
bin                    release

Persist the JAVA_HOME system variable for the current user

The JAVA_HOME system variable must be persisted when you leave and resstart a new Terminal Window.

One way to do this is to create or update a .profile file in the user's home directory. This file should contain all the commands that should be executed before the Terminal Window session starts.

Open the Terminal app and type the following commands:

cd $HOME
nano .profile

In the Text Editor, type the following line

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

You should have a screen similar to the following screenshot:

To save the .profile file, type CTRL + X, then type Y followed by the ENTER key.

Once done, quit the Terminal window, reopen a new one and type the following command to check if the system variable has been persisted:


You should have a non empty response.


results matching ""

    No results matching ""