Install Java 9 JDK/JRE on RHEL/CentOS 7/6 and Fedora 27-20

Most of the Linux operating systems comes with pre-installed OpenJDK package to run java-based applications and plugins. Now, you’re thinking if Java already ships with OS, why we need to install it again?. Yes! good question, but in certain cases we need Sun/Oracle Java program to compile and run particular development applications.

This is the reason, in this article we will cover the installation process of Java 9 Standard Edition Development Kit (JDK) and Java SE Runtime Environment (JRE) via binary packages in RHEL 7.x/6.x, CentOS 7.x/6.x and Fedora 27-20 systems using binary RPM files.

Downloading Java JDK / JRE 9 Binary

To install Java 9 in RHEL or CentOS based Desktop machine, open a browser and navigate to Java SE official download page and grab the latest .rpm binary package in your system.

For reference, we have provided the rpm file-names, please select these below mentioned files only.


Alternatively, you may use wget utility to download Java 9 RPM packages by issuing the below commands.

-------- Download Java SE JDK -------- 
# wget --no-cookies --no-check-certificate --header "Cookie: oraclelicense=accept-securebackup-cookie"

-------- Download Java SE JRE --------
# wget --no-cookies --no-check-certificate --header "Cookie: oraclelicense=accept-securebackup-cookie"

Install Java JDK / JRE 9

After Java .rpm file download completes, navigate to the directory where Java package has been downloaded and install Java JDK/JRE by issuing the below command. Answer with “y” (yes) when prompted in order to accept the package installation process made by system installer.

-------- On RHEL/CentOS 7/6 and Fedora -------- 
# yum install jdk-9.0.4_linux-x64_bin.rpm
# yum install jre-9.0.4_linux-x64_bin.rpm

-------- On Fedora 22+ Release -------- 
$ sudo dnf install jdk-9.0.4_linux-x64_bin.rpm
$ sudo dnf install jre-9.0.4_linux-x64_bin.rpm

Setup Java Environment Variables

Next, insert Java environment variables and the executable files path into your system $PATH variable, by issuing the below commands. This method ensures that Java environment variables and executables will be accessible system-wide.

-------- Set JAVA_HOME and Path Variable JDK -------- 
# export JAVA_HOME=/usr/java/jdk-9.0.4
# export PATH=$PATH:/usr/java/jdk-9.0.4/bin

-------- Set JAVA_HOME and Path Variable JRE --------
# export JAVA_HOME=/usr/java/jre-9.0.4
# export PATH=$PATH:/usr/java/jre-9.0.4/bin

Check Java JDK / JRE 9 Version

Finally, after Java has been installed, open a terminal and issue the below command to verify Java installed version in your system.

# java --version

java 9.0.4
Java(TM) SE Runtime Environment (build 9.0.4+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.4+11, mixed mode)

Enable Java JDK / JRE 9 Support in Firefox

To enable JDK /JRE support in Firefox we need to run the following commands to enable it. If you don’t have Firefox installed and like to install it, then check Install Latest Firefox in Linux guide.

# alternatives --install /usr/lib/mozilla/plugins/ /usr/java/jdk-9.0.4/lib/ 20000

Verify it, by restarting Firefox and enter about:plugins on the address bar.

Read Also: Install Java 8 JDK 8u45 in Debian and Ubuntu

Congratulations! You’ve successfully installed the latest version of Java 9 SE SDK in CentOS/RHEL based Linux systems.

Best Affordable Linux and WordPress Services For Your Business
Outsource Your Linux and WordPress Project and Get it Promptly Completed Remotely and Delivered Online.

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Get your own self-hosted blog with a Free Domain at ($3.45/month).
  4. Become a Supporter - Make a contribution via PayPal
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

Ravi Saive

I am Ravi Saive, creator of TecMint. A Computer Geek and Linux Guru who loves to share tricks and tips on Internet. Most Of My Servers runs on Open Source Platform called Linux. Follow Me: Twitter, Facebook and Google+

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

23 Responses

  1. Minal says:

    Hi Ravi,

    Great post, and really helpful.

    I have put your techniques into use, it worked

    Thanks for sharing!

  2. DMan says:

    I was looking for a way to install OpenJDK 8 on RHEL 5, as the Oracle version comes with a heavy price for commercial use. Do you have any insight into this? Is IBM Java available for RHEL 5 in RPM binary form?

    • Ravi Saive says:

      I don’t think that latest version of JDK 8 works on RHEL 5, due to version issues. I suggest you to do a system upgrade..

      • HNR says:

        @Ravi Saive
        Hi. I want to know if java 1.8 is supported on RHEL 5.11. Could you pls help?

        • Ravi Saive says:


          I don’t think that latest Java version will support on older CentOS 5.11, why not upgrade to newer CentOS version?

          • Andrew says:

            I’m not sure if it is technically supported on RHEL 5, but it is installable. The process is a hassle though. First, uninstall previous versions of Java. You may run into dependency issues while trying to uninstall the previous versions. The only way I found to fix this is to search for the specific java rpm (rpm -qa |grep -i java) and then remove that specific rpm: rpm -e –nodeps java-1.x.x. This is generally a really, really bad idea. However, if you’re in a jam, that should work.

            Then install the jre or jdk-1.8 rpm from oracles web site using either yum install jre-1.8.xx.rpm or rpm -vhi jre-1.8.xx.rpm.

            You’ll have to update /etc/alternatives. You should be able to search on how to do this. There is a nice article on unixmen, but I don’t know the rules for posting direct links on this site.

            Hope that helps.

  3. ales says:

    Hello I did every step you mention, but on Centos7 after check java -version it displays 1.7.0_u85 :-( I tried also install it from Centos7 repo and the result is same.

    • Ravi Saive says:

      I think you already have older version of Java installed, better remove it with yum and re-install the latest version as described in this article.

  4. kalyan says:

    Hello from the above we can download the java and how to install it is some what not clear for me..After that Install java in Linux and setting java as environment variables are not getting from above info..U have specified only rpm command..will it result of getting “environment variables setting” automatically?? & That is the only command enough for the task? clear me pls..and revert me to “[email protected]” Thank you…

  5. charles igbo says:

    Do you have a documentation on how to install JavaFX on centos.

Leave a Reply to Ravi Saive Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.