Linux Operating systems are already installed with Open JDK packages to run the Java-based applications. Now you think that if Java is already installed then why need to install again? But in certain cases, you need Sun/Oracle Java program to compile and run a particular program. You can hire freelancers who have knowledge and experience in Java programming language
The java platforms are in three editions Enterprises Edition, Micro Editions, and Standard Editions but this article mainly focuses on the Standard Edition. The Java Standard Edition has two different packages that are Java Runtime Environment (JRE) and Java Development Kit (JDK). JRE is an implementation of Java Virtual Machine (JVM). The JVM plays an important role to compiled and Run the programs, applets, and applications. The Java implementation has two parts viz. Open JDK and Oracle Java. Both implementations are based largely on the same code, But Oracle Java contains some proprietary code whereas Open JDK is completely open source. You can install a various version of Java on a single system, but many people like to install only single version. In this article, you find how to install different versions of Java on CentOS and Fedora.
Install OpenJDK 6 JRE
You can install the prebuilt Open JDK 6 JRE and JDK packages using the Yum, package manager. If you want to install OpenJDK 6 JRE, then run the following command.
Sudo yum install java-1.6.0-OpenJDK
After writing this command, the information prompt open in front of you enter y then RETURN to continue with the installation.
Install OpenJDK 6 JDK
After installation of OpenJDK 6 JRE now you have to install Open JDK 6 JDK using the yum, for that now write the following command.
Sudo yum install java- 1.6.0-openjdk-devel
After writing this command the confirmation prompt open in front of you enter, y then RETURN to continue with the installation.
Install OpenJDK 7
You can install the prebuilt Open JDK 7 JRE and JDK packages using the Yum, package manager. The OpenJDK 7 is the latest version of OpenJDK.
Install OpenJDK 7 JRE
For downloading OpenJDK 7 JRE using yum then write following command.
Sudo yum install java-1.7.0-openjdk.
After writing this command the confirmation prompt open in front of you enter, y then RETURN to continue with the installation.
Install OpenJDK 7 JDK
Run the following command to install Open JDK 7 JDK using the yum
sudo yum install java-1.7.0-OpenJDK-devel
After writing this command the confirmation prompt open in front of you enter, y then RETURN to continue with the installation.
Install oracle Java 8
Install Oracle Java 8 using oracle Java 8 JRE and Oracle Java 8 JDK
Install Oracle Java 8 JRE.
To install the Oracle Java 8 JRE go the Oracle Java 8 JRE Downloads Page and by accepting the license agreement copy the download link of Linux .rpm packages. In the highlighted part of the wget command place the copied download link. After changing the home directory download the Oracle
Java 8 JRE RPM through the following command
cd ~
wget –no-cookies –no-check-certificate –header “Cookie: gpw_e24=http:%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie” \
“http://download.oracle.com/otn-pub/java/jdk/8u60-b27/jre-8u60-linux-x64.rpm”
Through this command install RPM with yum
sudo yum localinstall jre-8u60-linux-x64.rpm
Now delete the archive file you download earlier.
rm ~/jre-8u60-linux-x64.rpm
Install Oracle Java 8 JDK
To install the Oracle Java 8 JDK go the Oracle Java 8 JDK Downloads Page and by accepting the license agreement copy the download link of Linux .rpm packages. In the highlighted part of the wget command place the copied download link. After changing the home directory download the Oracle Java 8 JDK RPM through the following command.
cd ~
wget –no-cookies –no-check-certificate –header “Cookie: gpw_e24=http:%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie” “http://download.oracle.com/otn-pub/java/jdk/8u60-b27/jdk-8u60-linux-x64.rpm”
Through this command install RPM with yum
sudo yum localinstall jdk-8u60-linux-x64.rpm
Now delete the archive file you download earlier.
rm ~/jdk-8u60-linux-x64.rpm
After installing multiple versions of Java, you have to set default version for setting the default version run the following command that is Java-version.
If you want to set the alternative version, then use the Alternative command this Alternative commands through symbolic link help you select the default Java command.
For alternative program use the following Alternative command you can find freelance jobs online in this sector easily.
Sudo alternatives –config java
Summary:
This article is about the how to install Java on CentOS and Fedora. In this article, you find information about how to install different versions of java on Fedora and CentOS and how to set alternative version of existing Java.