# Installing Java

The Oracle Java Development Kit (JDK) is required by the Caplin Platform to run Java-based Caplin Platform Blades (CPB) and the JMX monitoring service. This page provides an overview of the steps required to install Oracle Java and set the JAVA_HOME environment variable on Windows, Red Hat Linux and Mac OS X.

The Caplin Platform supports the following versions of the Oracle JDK:

• Oracle JDK 7 32-bit (Windows, Red Hat Linux)

• Oracle JDK 7 64-bit (Red Hat Linux, Mac OS X)

• Oracle JDK 8 32-bit (Windows, Red Hat Linux)

• Oracle JDK 8 64-bit (Red Hat Linux, Mac OS X)

Contents:

## Microsoft Windows

Follow the instructions below to install Oracle Java and set the JAVA_HOME environment variable.

1. Download and install a 32-bit Oracle JDK from the Oracle website.

 The Caplin Platform binaries for the Windows platform are 32-bit and require a 32-bit Oracle JDK.
2. On your keyboard, press Windows + Pause to open the System window

3. In the System window, navigate to Advanced system settings > Environment Variables

4. Set the value of the JAVA_HOME system environment variable to the full path to the JDK’s directory. For example: `C:\Program Files (x86)\Java\jdk1.8.0_60`

5. Append the JDK’s `bin` subdirectory to the PATH system environment variable, using a semi-colon to separate it from the preceding paths. Rather than repeat the path to the JDK directory, you can reference the JAVA_HOME variable. For example: `%JAVA_HOME%\bin`

## Red Hat Linux

Red Hat Linux supports the installation of multiple JDKs, and provides the `alternatives` command to select the active JDK. Follow the instructions below to install Oracle Java and set the JAVA_HOME environment variable.

1. Prepare the `alternatives` file-system links by installing the OpenJDK development package of the same major version as the Oracle JDK you want to install. For example, to prepare for the installation of Oracle JDK 8, install the OpenJDK 8.

`$sudo yum install java-1.8.0-openjdk java-1.8.0-openjdk-devel` 2. From the Oracle website, download the RPM for the version of Oracle JDK that you require. 3. Install the downloaded RPM. The example command below installs the RPM for the Oracle JDK 8 update 65 (64-bit). `$ sudo yum install jdk-8u65-linux-x64.rpm`
4. Run the two commands below to select the active Java installation. When prompted, select the Oracle JDK as the default installation.

`$sudo alternatives --config java` `$ sudo alternatives --config javac`
5. Update your `~/.bash_profile` file with the following lines:

`JAVAC_PATH=$(readlink -f /etc/alternatives/javac)` `export JAVA_HOME=${JAVAC_PATH%/bin/javac}`
 `/etc/alternatives/javac` is an automatically-maintained link that is updated by the command `alternatives --config javac`
6. Log off and log back in to your account. The `~/.bash_profile` file is only run on login.

## Mac OS X

Follow the instructions below to install Oracle Java and set the JAVA_HOME environment variable.

1. Download and run the Oracle JDK installer from the Oracle website.

2. Update your `~/.bash_profile` file with the following line:

`export JAVA_HOME=\$(/usr/libexec/java_home)`
 By default, the `/usr/libexec/java_home` program returns the path to the most recently installed JDK.
3. Log off and log back in to your account. The `~/.bash_profile` file is only run on login.

For more information on installing Oracle Java on OS X, see Information and system requirements for installing and using Oracle Java on Mac OS X.