Installing Oracle JRE or JDK on RHEL-based Systems

Steps for installing the Oracle JRE or JDK on RHEL-based Systems.

Attention: Although Oracle JRE/JDK 8 is supported, DataStax does more extensive testing on OpenJDK 8. This change is due to the end of public updates for Oracle JRE/JDK 8.
Configure your system to use the latest version of Oracle Java SE 8 JRE or JDK. The minimum supported version is 1.8u151. Java 9 and later are not supported.
Note: JDK provides more classes and tools for support and troubleshooting operations.

  1. Check if Java is installed:
    java -version
    If Oracle Java, the results should look like:
    java version "1.8.0_181"
    Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
    Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)
  2. To install Oracle Java, go to Oracle Java SE Downloads, accept the license agreement, and download the installer for your distribution.
    Note: If installing the Oracle Java 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. From the directory where you downloaded the package, run the install:
    sudo rpm -ivh jdk-8uversion-linux-x64.rpm

    The RPM installs the JDK into the /usr/java/ directory.

  4. Set your system to use the Oracle JDK:
    sudo alternatives --install /usr/bin/java java /usr/java/jdk1.8.0_version/bin/java 200000
  5. Use the alternatives command to switch to the Oracle JDK.
    sudo alternatives --config jav
    Note: If you have trouble, you may need to set JAVA_HOME and PATH in your profile, such as .bash_profile.
    The following examples assume that the JDK is in /usr/java and which java shows /usr/bin/java:
    • Shell or bash:
      export JAVA_HOME=/usr/java/latest &&
      export PATH=$JAVA_HOME/bin:$PATH
    • C shell (csh):
      setenv JAVA_HOME "/usr/java/latest" && 
      setenv PATH $JAVA_HOME/bin:$PATH
  6. Make sure your system is using the correct JRE or JDK:
    java -version
    java version "1.8.0_181"
    Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
    Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)