nordvpn

How to install Java 11 on CentOS 7/Redhat 7

How to install Java 11 on CentOS 7

In this tutorial, I will show you how to install Java 11 on Centos 7/Redhat 7. The Java Development Kit (JDK) is a software development environment used for developing Java applications and applets. It includes the Java Runtime Environment (JRE), an interpreter/loader (java), a compiler (javac), an archiver (jar), a documentation generator (Javadoc) and other tools needed in Java development.

Pre-requisites

  • Centos 7 install with root access

Read Also: Install postgreSQL 11 on Debian 10 (Buster)

Install Java 11

Here we will use yum to install Java 11 on Centos 7.

$ yum install java-11-openjdk

Check java Version

Now after installing open JDK check the version using the following command

$ java -version
openjdk version "11.0.1" 2018-10-16 LTS
OpenJDK Runtime Environment 18.9 (build 11.0.1+13-LTS)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.1+13-LTS, mixed mode, sharing)

Read Also: How to install Java 11 on CentOS 7

Set Java Home Environment

We need to set Java home Environment Variable in order to use java with some applications. Let’s get started.

$ alternatives --config java
There is 1 program that provides 'java'.
Selection Command
-----------------------------------------------
*+ 1 java-11-openjdk.x86_64 (/usr/lib/jvm/java-11-openjdk-11.0.1.13-3.el7_6.x86_64/bin/java)

Option 1: Set Environment Variable

$ export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-11.0.1.13-3.el7_6.x86_64/bin/java

$ echo $JAVA_HOME
/usr/lib/jvm/java-11-openjdk-11.0.1.13-3.el7_6.x86_64/bin/java

Option 2: Adding in .bash_profile

In this option, I will add an entry in .bash_profile.

$ vim ~/.bash_profile

and paste the following and save and quit.

$ export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-11.0.1.13-3.el7_6.x86_64/bin/java

Now source the file.

$ source ~/.bash_profile

Now check the Java Home

$ echo $JAVA_HOME
/usr/lib/jvm/java-11-openjdk-11.0.1.13-3.el7_6.x86_64/bin/java

If you have any issue using this tutorial please feel free to comment below.

Leave a Reply

Your email address will not be published.


*



The reCAPTCHA verification period has expired. Please reload the page.

48-Hour Flash Sale! Courses from just $10.99