Java is a secure, stable, and well known, general-purpose programming language and computing technology platform with many interconnected capabilities.
To run Java-based applications, you must have Java installed on your server. You mostly need the Java Runtime Environment (JRE), a collection of software components used to run Java applications on the Linux machine.
If you want to develop software applications for Java, you need to install the Oracle Java Development Kit (JDK), which comes with a complete JRE package with tools for developing, debugging, and monitoring Java applications and it is an Oracle’s supported Java SE (Standard Edition) version.
Note: If you are looking for an open-source and free JDK version, install the OpenJDK which provides the same features and performance as Oracle JDK under the GPL license.
At the time of writing this article, OpenJDK 11 is the current LTS version of Java to be installed using the following command from the default repositories:
# yum install java-11-openjdk-devel # java -version
Sample Output
openjdk 11.0.8 2020-07-14 LTS OpenJDK Runtime Environment 18.9 (build 11.0.8+10-LTS) OpenJDK 64-Bit Server VM 18.9 (build 11.0.8+10-LTS, mixed mode, sharing)
In this article, we will show you how to install Oracle OpenJDK 14 in RHEL 8/7/6, CentOS 8/7/6, and Fedora 30-32 to develop and run Java applications.
Installing Oracle OpenJDK 14 in CentOS/RHEL and Fedora
To install Oracle OpenJDK 14, you need to download the production-ready OpenJDK 14 from the Java SE Downloads page or run the following wget command to download and install it as shown.
# wget --no-check-certificate -c --header "Cookie: oraclelicense=accept-securebackup-cookie" https://download.oracle.com/otn-pub/java/jdk/14.0.2+12/205943a0976c4ed48cb16f1043c5c647/jdk-14.0.2_linux-x64_bin.rpm
Install the package using the following command:
# yum localinstall jdk-14.0.2_linux-x64_bin.rpm
If you have more than one Java version installed on the system, you need to set the default version using the alternatives command as shown.
# alternatives --config java
Sample Output
There are 2 programs which provide 'java'.
Selection Command
-----------------------------------------------
+ 1 java-11-openjdk.x86_64 (/usr/lib/jvm/java-11-openjdk-11.0.8.10-0.el8_2.x86_64/bin/java)
* 2 /usr/java/jdk-14.0.2/bin/java
Enter to keep the current selection[+], or type selection number: 2
Just, enter the number to set the default Java version on the system.
Finally, check the Java version.
# java -version
Sample Output
java version "14.0.2" 2020-07-14 Java(TM) SE Runtime Environment (build 14.0.2+12-46) Java HotSpot(TM) 64-Bit Server VM (build 14.0.2+12-46, mixed mode, sharing)
Congratulations! You’ve successfully installed the latest version of Oracle OpenJDK 14 in RHEL 8/7/6, CentOS 8/7/6, and Fedora 30-32 to develop and run Java applications.
Hi ravi,
i have installed centos 6.4 in desktop mode successfully in m y machine. can able to act as a SVN Server in that machine.
How do I save and exit out of the repo once i have entered the content in?
Press [Esc] key and type Shift+ZZ to save file.
How to install if I’m not a root user? `rpm -Uvh` requires me to be root.
Thanks.
Is there something wrong with the Fedora package?
After installing the package with rpm -Uvh jdk-7u25-linux-x64.rpm the following command would not list it:
alternatives –config java
Only shows one and that’s openjdk
java -version gives me open jdk.
Installing the package again (no errors or warnings the first time) tells me it already installed.
I’ll try a reboot and see if that helps,.
I did everything but it did not work…
Then tried telnet localhost 8080
[[email protected] ~]$ telnet localhost 8080
Trying 127.0.0.1…
telnet: connect to address 127.0.0.1: Connection refused
[[email protected] ~]$
apche tomcat bootstartup error when i service tomcat stop
What exact error? can you post here.
127.0.0.1 is apche2 is running but 127.0.0.1:8080 not runny ..unable to connect :(
Have you checked port is listening. Do a telnet to 8080.
Hi.. I’m very newbi to putty. Even I do not know the usage of linux machine.
Now I want to learn
How to install jdk in CentOS release 5.9 (Final) using putty ?
Could plz. provide step by step procedure ?
Thanks,
Sadakar
Thank you!
I did everything to get Firefox to recognize the plugin and this doc finally helped. I didn’t know that I had to do alternates in the actual plugin directory.
Thank You
Clint