jdk14 install

sudo yum -y install curl
curl -O https://download.java.net/java/GA/jdk14/076bab302c7b4508975440c56f6cc26a/36/GPL/openjdk-14_linux-x64_bin.tar.gz

Extract the downloaded OpenJDK 14 archive file using tar command.

tar xvf openjdk-14_linux-x64_bin.tar.gz

Move the resulting folder to /opt directory.

sudo mv jdk-14 /opt/

Configure Java environment:

sudo tee /etc/profile.d/jdk14.sh <<EOF
export JAVA_HOME=/opt/jdk-14
export PATH=\$PATH:\$JAVA_HOME/bin
EOF

Source your profile file and check java command

source /etc/profile.d/jdk14.sh

Confirm Java version.

$ echo $JAVA_HOME
/opt/jdk-14

$ java -version
openjdk version "14" 2020-03-17
OpenJDK Runtime Environment (build 14+36-1461)
OpenJDK 64-Bit Server VM (build 14+36-1461, mixed mode, sharing)

Option 2: Install Java SE Development Kit 14 on CentOS 8/7 & Fedora 31-29

If you choose to go with Java SE Development Kit 14, download RPM package for CentOS / RHEL / Fedora system using the command below.

curl -LO -H "Cookie: oraclelicense=accept-securebackup-cookie" \
"https://download.oracle.com/otn-pub/java/jdk/14+36/076bab302c7b4508975440c56f6cc26a/jdk-14_linux-x64_bin.rpm"

Then install the RPM package using the yum or rpm command.

$ sudo rpm -Uvh jdk-14_linux-x64_bin.rpm
warning: jdk-14_linux-x64_bin.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Verifying...                                                            (10################################# [100%]
Preparing...                                                            (10################################# [100%]
Updating / installing...
   1:jdk-14-2000:14-ga                ################################# [100%]

Confirm Java version installed

$ java -version
java version "14" 2020-03-17
Java(TM) SE Runtime Environment (build 14+36-1461)
Java HotSpot(TM) 64-Bit Server VM (build 14+36-1461, mixed mode, sharing)

Configure Java environment.

cat <<EOF | sudo tee /etc/profile.d/jdk14.sh
export JAVA_HOME=/usr/java/default
export PATH=\$PATH:\$JAVA_HOME/bin
EOF

To use Java Home, source the file.

source /etc/profile.d/jdk14.sh

Last updated