Install Oracle Java 11 on Fedora 29/CentOS 7

|
Last Updated:
|
|

In this guide, we are going to learn how to install Oracle Java 11 on Fedora 29/CentOS 7. There are different flavors of Java on which different applications can run on. For example, Oracle Java SE which is the official version of Java from Oracle and is not opensource. The other flavour is OpenJDK, an opensource edition of Java. This version is included on Fedora repos by default.

Installing Oracle Java 11 on Fedora 29/CentOS 7

To install Oracle Java 11 on Fedora 29 or CentOS 7, follow through this guide.

Download Oracle Java 11 Archive

Navigate to Oracle Java 11 downloads page, accept the license and download the tar.gz archive.

Create Java Directory

Run the command below to create a directory where Java 11 files will reside.

mkdir /usr/java

Unpacking the Java 11 Archive

Once you have downloaded the tar.gz archive, unpack it to Java directory created above by running the command below;

tar xzf jdk-11.0.3_linux-x64_bin.tar.gz -C /usr/java

This will extract the Java 11 files under, /usr/java/jdk-11.0.3/.

Set Java 11 Default Location

Run the commands below to define Java 11 default locations.

update-alternatives --install "/usr/bin/java" "java" "/usr/java/jdk-11.0.3/bin/java" 0
update-alternatives --install "/usr/bin/javac" "javac" "/usr/java/jdk-11.0.3/bin/javac" 0
update-alternatives --install "/usr/bin/jar" "jar" "/usr/java/jdk-11.0.3/bin/jar" 0
update-alternatives --set java /usr/java/jdk-11.0.3/bin/java
update-alternatives --set javac /usr/java/jdk-11.0.3/bin/javac
update-alternatives --set jar /usr/java/jdk-11.0.3/bin/jar

Verify Java Installation

The installation in other words is done. To verify the installed version, log out of the system and login again. After that run the command below;

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

Good stuff, isn’t?

Create JAVA_HOME Environment Variable

Now that we got Java 11 installed, you can create the Java home environment variable under the /etc/environment configuration file.

echo 'JAVA_HOME="/usr/java/jdk-11.0.3"' >> /etc/environment
source /etc/environment

Verify environment variable setting.

echo $JAVA_HOME
/usr/java/jdk-11.0.3

You are done with installation of Oracle Java 11 on Fedora 29/CentOS 7. Enjoy.

You can check our guides on Oracle Java 12 by following the links below;

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