Java is somewhat one of the most important applications on your system and not having java can bring nightmares. It is suggested to users after installing Linux on your computer, you should install java on it. In this article, I’m going to show you how to install java 7/8 in Fedora, CentOS or derivatives distros. Here is a tutorial to install Oracle Java (JDK 7/8) on Fedora and CentOS.
If you want to install Java on Ubuntu, you can find a tutorial here.
How To Install Oracle Java On Fedora And CentOS?
Oracle JAVA 8 is a stable release and available to download and install on the official download page.
Firstly you will have to download the packages for installing Java on your system. You can find the JDK 7 here / JRE 7 here and JDK 8 here / JRE 8 here. These packages will be in rpm form (.rpm) and you will have to check the architecture as well i.e 32 bit or 64 bit. While downloading you will have to accept the License Agreement to download.
The installation will be done using the following commands –
Steps to install Java:
Step 1: First step is to change to root user
This is to provide appropriate permissions so as to install the packages.sudo -i
Step 2: Next step is to install the JDK.
While installing firstly check which version of Java you want to install i.e Oracle Java 7 or 8. Also, you will have to keep in mind to choose packages according to the system architecture, the packages will have to be downloaded keeping a check on it.
rpm -Uvh /path/jdk-version-linux-architecture.rpm Eg “rpm -Uvh /home/user/Downloads/jdk-8u111-linux-x64.rpm”
Steps for Oracle Java JDK 7 (32 bit)
Steps for Oracle Java JDK 7 (64 bit)
Steps for Oracle Java JDK 8 (32 bit)
Steps for Oracle Java JDK 8 (64 bit)
Step3: After installing Jdk we have to install Jre
Eg “rpm -Uvh /home/user/Downloads/jre-8u111-linux-x64.rpm”
“rpm -Uvh /path/jre-version-linux-architecture.rpm”
Steps for Oracle Java JRE 7 (32 bit)
Steps for Oracle Java JRE 7 (64 bit)
Steps for Oracle Java JRE 8 (32 bit)
Steps for Oracle Java JRE 8 (64 bit)
Now Java is installed on your system
Step 4:Check java version
Step 5: Lastly we have to configure the alternatives. Alternatives are configured to make the newer version of java which you have installed as the default program for running java.
sudo alternatives --install (old path) java (new path)
Enjoy the power of Java on your system.
For any assistance or problem ask me in the comment box.