Hamsa K
Editor
4 min read | 4 years ago

How to Install JAVA 13 on Centos 8

Install Java 13 on Centos 8

Java is a secure, stable, well known, and general-purpose programming language. Java 13 was released for production use on 17th September 2019.In this tutorial we will see how to install java.

Some of the important Java 13 features:

Text Blocks – JEP 355
New Methods in String Class for Text Blocks
Switch Expressions Enhancements – JEP 354
Reimplement the Legacy Socket API – JEP 353
JEP 350: Dynamic CDS Archives
ZGC: Uncommit Unused Memory – JEP 351
FileSystems.newFileSystem() Method
DOM and SAX Factories with Namespace Support

Step 1: Download Java 13

Download the latest Java SE Development Kit 13 release from its official download

page or you can use below link to download through commandline.

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

Step 2: Install Java

once you have downloaded rpm file you can install it by executing below command.

[root@centos ~]# yum localinstall jdk-13.0.1_linux-x64_bin.rpm
[root@centos ~]# yum localinstall jdk-13.0.1_linux-x64_bin.rpm
Last metadata expiration check: 0:06:18 ago on Sat 23 Nov 2019 04:23:41 PM IST.
Dependencies resolved.
========================================================================================================================================================================
 Package                                Arch                               Version                                       Repository                                Size
========================================================================================================================================================================
Installing:
 jdk-13.0.1                             x86_64                             2000:13.0.1-ga                                @commandline                             163 M
Transaction Summary
========================================================================================================================================================================
Install  1 Package
Total size: 163 M
Installed size: 308 M
Is this ok [y/N]: y
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                1/1
  Installing       : jdk-13.0.1-2000:13.0.1-ga.x86_64                                                                                                               1/1
  Running scriptlet: jdk-13.0.1-2000:13.0.1-ga.x86_64                                                                                                               1/1
  Verifying        : jdk-13.0.1-2000:13.0.1-ga.x86_64                                                                                                               1/1
Installed:
  jdk-13.0.1-2000:13.0.1-ga.x86_64

Step 3: Verify Java version

Now you can verify java version by using below command

[root@centos ~]# java --version
java 13.0.1 2019-10-15
Java(TM) SE Runtime Environment (build 13.0.1+9)
Java HotSpot(TM) 64-Bit Server VM (build 13.0.1+9, mixed mode, sharing)

If you have installed multiple versions of java installed in your system use below command to set default java version.

alternatives --config java

sample output:

[root@centos ~]# alternatives --config java
There is 1 program that provides 'java'.
  Selection    Command
-----------------------------------------------
*+ 1           /usr/java/jdk-13.0.1/bin/java
Enter to keep the current selection[+], or type selection number: 1

Step 4: Setup Java Environment variables

set JAVA_HOME variable like below

[root@centos ~]# export JAVA_HOME=/usr/java/jdk-13.0.1

Now edit /etc/environment file and add above line to that file.

[root@centos ~]# echo 'JAVA_HOME="/usr/java/jdk-13.0.1"' >> /etc/environment

Source /etc/environment file to reload

[root@centos ~]# source /etc/environment

Now you can verify java Home path 

[root@centos ~]# echo $JAVA_HOME
/usr/java/jdk-13.0.1

 



Warning! This site uses cookies
By continuing to browse the site, you are agreeing to our use of cookies. Read our terms and privacy policy