1. Download the Archive
curl -O https://download.java.net/java/GA/jdk12.0.1/69cfe15208a647278a19ef0990eea691/12/GPL/openjdk-12.0.1_linux-x64_bin.tar.gz
2. Extract
tar xvf openjdk-12.0.1_linux-x64_bin.tar.gz
3. Move the directory to /opt
sudo mv jdk-12.0.1 /opt/
4. Set the PATH
cat <<EOF | sudo tee /etc/profile.d/jdk12.sh
export JAVA_HOME=/opt/jdk-12.0.1
export PATH=\$PATH:\$JAVA_HOME/bin
EOF
5. Run the profile
source /etc/profile.d/jdk12.sh
6.Check Home Directory and Version
echo $JAVA_HOME
java –version