Install Oracle Java 12 on CentOS 7/Fedora 29

|
Last Updated:
|
|

In this guide, we are going to learn how install Oracle Java 12 on CentOS 7/Fedora 29. For the installation of Oracle Java 12 on Ubuntu 18.04/Debian 9.8 servers, check our previous article by following either of the link below.

How to Manually Install Oracle Java 12 on Debian 9.8/Ubuntu 18.04
Install Oracle Java 12 on Ubuntu 18.04/Debian 9.8

Installing Oracle Java 12 on CentOS 7/Fedora 29

Download Java 12 RPM binary

Navigate to Official Oracle Java 12 downloads page and download the latest Java 12 RPM binary. You can simply get the link and use wget to download it.

wget --no-check-certificate -c --header "Cookie: oraclelicense=accept-securebackup-cookie" https://download.oracle.com/otn-pub/java/jdk/12.0.1+12/69cfe15208a647278a19ef0990eea691/jdk-12.0.1_linux-x64_bin.rpm

Install Java 12 on CentOS 7/Fedora 29

Once you get the RPM binary, you can install it by executing the command below;

On CentOS 7

yum localinstall jdk-12.0.1_linux-x64_bin.rpm

On Fedora 29

rpm -ivh jdk-12.0.1_linux-x64_bin.rpm

Once the installation is done, you should be having the Java files in their right directories. If you have other Java versions installed, you can run the command below to make Java 12 the default Java version.

alternatives --config java

Verify Java 12 installation

You can tun java –version command to check your Oracle Java version.

java --version
java 12.0.1 2019-04-16
Java(TM) SE Runtime Environment (build 12.0.1+12)
Java HotSpot(TM) 64-Bit Server VM (build 12.0.1+12, mixed mode, sharing)

Create Java Environment Variable

To create Java environment variable, edit the /etc/environment file and add the line below;

vim /etc/environment
JAVA_HOME="/usr/java/jdk-12.0.1"

Source the /etc/environment file to reload the environment variables.

source /etc/environment

Verify the environment variable setting.

echo $JAVA_HOME
/usr/java/jdk-12.0.1

That is all about how install Java 12 on CentOS 7/Fedora 29. Enjoy coding. You can also check our other guide on installing Oracle Java by following the links below;

Install Oracle Java 11 on Fedora 29/CentOS 7

How to Manually Install Oracle Java 12 on Debian 9.8/Ubuntu 18.04

Install Oracle Java 12 on Ubuntu 18.04/Debian 9.8

Install Java 11 on Debian 9.8/Ubuntu 18.04

SUPPORT US VIA A VIRTUAL CUP OF COFFEE

We're passionate about sharing our knowledge and experiences with you through our blog. If you appreciate our efforts, consider buying us a virtual coffee. Your support keeps us motivated and enables us to continually improve, ensuring that we can provide you with the best content possible. Thank you for being a coffee-fueled champion of our work!

Photo of author
koromicha
I am the Co-founder of Kifarunix.com, Linux and the whole FOSS enthusiast, Linux System Admin and a Blue Teamer who loves to share technological tips and hacks with others as a way of sharing knowledge as: "In vain have you acquired knowledge if you have not imparted it to others".

Leave a Comment