Installing Oracle JRE on Debian or Ubuntu Systems

Cassandra 1.2 requires Oracle JRE.

You must configure your operating system to use the Oracle JRE, not the OpenJDK. The latest 64-bit version of Java 6 or 7 is recommended. The minimum supported versions are 1.6.0_29 and 1.7.0_25.

Note: After installing the JRE, you may need to set JAVA_HOME:
$ export JAVA_HOME=<path_to_java>
The Oracle Java Runtime Environment (JRE) has been removed from the official software repositories of Ubuntu and only provides a binary (.bin) version. You can get the JRE from the Java SE Downloads.

Procedure

  1. Check which version of the JRE your system is using:
    java -version

    If Oracle Java is used, the results should look like:

    java version "1.7.0_25"
    Java(TM) SE Runtime Environment (build 1.7.0_25-b15)
    Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)
  2. If necessary, go to Oracle Java SE Downloads, accept the license agreement, and download the installer for your distribution.
    Note: If installing the Oracle JRE in a cloud environment, accept the license agreement, download the installer to your local client, and then use scp (secure copy) to transfer the file to your cloud machines.
  3. Place the downloaded file in the /usr/java/latest directory.
  4. From the /usr/java/latest directory, unpack the tarball and install the JRE:
    $ sudo tar zxvf jre-7u<version>-linux-x64.tar.gz

    The JRE files are installed into a directory called jre-7u_<version>.

  5. Tell the system that there's a new Java version available:
    $ sudo update-alternatives --install "/usr/bin/java" "java" "/usr/java/latest/jre1.7.0_<version>/bin/java" 1

    If updating from a previous version that was removed manually, execute the above command twice, because you'll get an error message the first time.

  6. Set the new JRE as the default:
    $ sudo update-alternatives --set java /usr/java/latest/jre1.7.0_<version>/bin/java
    
  7. Make sure your system is now using the correct JRE. For example:
    $ java -version
    java version "1.7.0_25"
    Java(TM) SE Runtime Environment (build 1.7.0_25-b15)
    Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)