Friday, April 8, 2022

[SOLVED] Installing open jdk 11 on centos using yum commands

Issue

I want to install open jdk 11 using yum command . however when i check the open jdk manual , it says up to jdk version 1.8 you can use yum command . how ever with 9 on wards you have to download zip or tar file . (https://openjdk.java.net/install/)

any reason why we are not provided with a yum command. I am bit newbie to linux. appreciate any help


Solution

The reason, in short, is because someone has to maintain the packages and put these into the repositories your system is using and verify, that they run stable. For example, the OpenJDK 11 on Debian is still in buster (testing) and sid (unstable) and therefore not available in any stable branch. I guess in CentOS (I am not that familiar with it tbh.) it's the same situation.

Sooner or later you'll have to install software without a manager in any OS, so even if you're saying you're a noob, you'll have to learn that sooner or later. And if you want to use openjdk11 now, you'll have to use either an unofficial repository or install the software by hand, what I'd recommend.

However, here is a guide which is the second hit on Google for openjdk11 centos:

curl -O https://download.java.net/java/GA/jdk11/13/GPL/openjdk-11.0.1_linux-x64_bin.tar.gz
tar zxvf openjdk-11.0.1_linux-x64_bin.tar.gz
mv jdk-11.0.1 /usr/local/

vi /etc/profile.d/jdk11.sh

# create new
export JAVA_HOME=/usr/local/jdk-11.0.1
export PATH=$PATH:$JAVA_HOME/bin

source /etc/profile.d/jdk11.sh

java -version

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

Source: https://www.server-world.info/en/note?os=CentOS_7&p=jdk11&f=2



Answered By - maio290
Answer Checked By - Marie Seifert (WPSolving Admin)