Download and install javaΒ
sudo yum install java-11
Use Alternatives toΒ change your default versionΒ
sudo alternatives --config javaΒ Β - then select the numberΒ
update version using update-alternateΒ
sudo update-alternatives --config java
Check java versionΒ
java -version
Change java home directoryΒ
there are multiple ways try one of the following and user which one works for you
sudo vi ~/.bashrc
sudo vi ~/.bash_profile
sudo vi /etc/profile
sudo vi /etc/profile.d/java.sh
update or add the following values
export JAVA_HOME="pathΒ of you java"
export PATH=$JAVA_HOME/bin:$PATH
try echo $JAVA_HOMEΒ and make sure it is showing the current version