1sudo apt install -y curl
2curl -O https://download.java.net/java/GA/jdk13/5b8a42f3905b406298b72d750b6919f6/33/GPL/openjdk-13_linux-x64_bin.tar.gz
3tar xvf openjdk-13_linux-x64_bin.tar.gz
4
5sudo mv jdk-13 /opt/
6 sudo tee /etc/profile.d/jdk.sh <<EOF
7 export JAVA_HOME=/opt/jdk-13
8 export PATH=\$PATH:\$JAVA_HOME/bin
9 EOF
10
11source /etc/profile.d/jdk13.sh
12
13echo $JAVA_HOME
14
15java -version
16
17### Second Approach to install java 13 along side other java versions
18## Check this link https://medium.com/@ayeshajayasankha/how-to-install-and-switch-between-alternative-java-versions-66b3671fc382
19
20curl -O https://download.java.net/java/GA/jdk13/5b8a42f3905b406298b72d750b6919f6/33/GPL/openjdk-13_linux-x64_bin.tar.gz
21tar xvf openjdk-13_linux-x64_bin.tar.gz
22export JAVA_HOME=<Directory where JAVA has been extracted>/jdk-13
23export PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
24. /etc/profile
25sudo update-alternatives --install "/usr/bin/java" "java" "<Directory where JAVA has been extracted>/bin/java" 1
26sudo update-alternatives --install "/usr/bin/javac" "javac" "<Directory where JAVA has been extracted>/bin/javac" 1
27sudo update-alternatives --set java <Directory where JAVA has been extracted>/bin/java
28sudo update-alternatives --set javac <Directory where JAVA has been extracted>/bin/javac
29java -version
30javac -version
31