Install Java on Fedora – [JDK 6,7,8 and Oracle 8&9 JDK]- Beginner Tutorial


There are various versions of Java available for you to install.

Here in this article:

we will see how to install Open JDK Version 6,7 and 8 and also,

we will see How to install Oracle Java 9 and 8.

Java has three editions such as Java EE(Enterprise Edition), Java SE(Standard Edition) and Java ME(Micro Edition).

Here,  in this tutorial, we will see how to install the Java Standard Edition Development Kit (JDK) and Java Runtime Environment (JRE).

Here, the Java Runtime Environment helps you to compile and run the programmers.

You will need a Java Development Kit to develop java programmers.

The JDK includes the Java Runtime environment.

There are two types in Java installation. One is Installation of Open JDK and the other is Oracle Java.

The Major difference between both of them is Open Source. Here Open JDK is open source and Oracle Java contains some specific codes.

You do not need to worry much about the functions. Both of them are supporting all types of software.

Also, A user can install various versions of Java in his system and use the required one.

Mostly you don’t need to install all the versions of Java and you only need one.

It is our recommendation to install a single standard version of Java.

Even, if you install multiple versions of Java, you can switch between them.

Let us see all the required instructions to install java on fedora in this article. 

Get 50$ Credit on Vulture Clouds Here and Test the Instruction for free.

Open JDK 6 Installation

We will install Open JDK RE using the below command.

$ sudo yum install java-1.6.0-openjdk

When you prompted, Enter Y and Press Enter button.

To Install Open JDK 6 JDK use the below command.

$ sudo yum install java-1.6.0-openjdk-devel

Press Y and Then hit enter.

Open JDK 7 Installation

To install Open JDK 7 RE, use this command.

$ sudo yum install java-1.7.0-openjdk

Install Open JDK 7 JDK using the below command.

$ sudo yum install java-1.7.0-openjdk-devel

Open JDK 8 Installation

The commands are similar to each other. In the same way as above, install Open JDK 8 RE using the below command.

$ sudo yum install java-1.8.0-openjdk

To install Open JDK 8 JDK, use this command.

sudo yum install java-1.8.0-openjdk-devel

Install Oracle Java 9 on Fedora

Here in this section, let us see how to install Oracle Java 9 RE and Oracle Java 8 JDK.

Here is the link to the page where you can find a link for downloading oracle java file.

We will download the file from an external source and install.

For that, we will require wget. To install wget, use the below command.

$ sudo yum install wget

After that, switch to the home directory.

$ cd ~

Then, use download Oracle 9 JRE Package using the below command.

$ wget --no-cookies --no-check-certificate --header "Cookie:; oraclelicense=accept-securebackup-cookie" "http://link_copied_from_site"

The Package will have .rpm extensions.

To install the downloaded package, here is the command.

$ sudo yum localinstall jre-9.0.4_linux_x64_bin.rpm

You will be asked to enter Yes or No, Just type Y and Hit enter.

Then, run the below command to remove the downloaded package to free up space.

$ rm ~/jre-9.0.4_linux_x64_bin.rpm

To Install Oracle 9 JDK, here is the command.

$ cd ~
wget --no-cookies --no-check-certificate --header "Cookie:; oraclelicense=accept-securebackup-cookie" "http://link_copied_from_site"

Now, the package will be downloaded. You can use this command run the installation of the downloaded file.

$ sudo yum localinstall jdk-9.0.4_linux-x64_bin.rpm

After the installation process, Just remove the downloaded archive using the below command.

$ rm ~/jdk-9.0.4_linux-x64_bin.rpm

Install Oracle Java 8 on Fedora

Here is the simple command to download the Oracle Java 8 RE Package.

$ cd ~
$ wget --no-cookies --no-check-certificate --header "Cookie:; oraclelicense=accept-securebackup-cookie" "http://link_copied_from_site"

To install the downloaded Oracle Java 8 RE package, use this command.

Then, remove the archive file, use this command.

$ sudo yum localinstall jre-8u161-linux-x64.rpm

To install Oracle Java 8 JDK, first, download the appropriate .rpm package.

Here is the command for that.

Then, install the JDK using the below command.

$ cd ~
$ wget --no-cookies --no-check-certificate --header "Cookie:; oraclelicense=accept-securebackup-cookie" "http://link_copied_from_site"

Install the Package using the below command.

$ sudo yum localinstall jdk-8u161-linux-x64.rpm

Then, remove the archive file using this command.

$ rm ~/jdk-8u161-linux-x64.rpm

Setup the default JDK version

Since we have downloaded and installed multiple versions of Java, we have to decide which we should use by default.

To find the existing version of Java, use the below command.

$ java -version

To see all the available Java versions, use this command.

$ sudo alternatives --config java

You will get the following output with prompt asking to enter a number from the list to set up the java versions.

There are 5 programs which provide ‘java’.

Selection    Command
  1         java-1.7.0-openjdk.x86_64 (/usr/lib/jvm/java-1.7.0-openjdk-
  2         java-1.8.0-openjdk.x86_64 (/usr/lib/jvm/java-1.8.0-openjdk-
  3         /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java
*+ 4           /usr/java/jre-9.0.4/bin/java
  5         /usr/java/jdk-9.0.4/bin/java

Enter to keep the current selection[+], or type selection number:

Enter any number from the list to continue.


That’s all. Now you have learned how to install various versions of Java and how to switch between them.

If you have any queries, leave them in command.

Also, make sure to subscribe to receive new tutorials on the cloud, server management, and Operating systems.


Share on facebook
Share on twitter
Share on linkedin