This post will outline how to install Oracle Java JDK in Fedora, Red Hat or CentOS.
Please note that this will only install the JDK, when you’re done you will need to select this JDK to be able to use it. That is outlined in this blog post: Easily switch between java versions using alternatives in Linux
First determine if you need 32 or 64 bit. If you’re unsure you can check using “uname -p” in a terminal which will display your kernel and which architecture you’re using.
Next, download the JDK that you wish to use. In this example I will be installing the latest JDK from Oracle, you can find it here: Oracle Java Downloads.
I have chosen Java Platform (JDK) 8u31, which downloads the RPM.
After the download is finished, open a terminal and go to the location of the download.
Next, enter this command:
sudo yum install jdk-8u31-linux-x64.rpm
This will install the JDK.
Important: After this is done, you have placed all the files in the right location, but can’t use it until you’ve finished the steps in this blog post: Easily switch between java versions using alternatives in Linux