how to install java jdk 13 on linux

sudo apt install -y curl
curl -O https://download.java.net/java/GA/jdk13/5b8a42f3905b406298b72d750b6919f6/33/GPL/openjdk-13_linux-x64_bin.tar.gz
tar xvf openjdk-13_linux-x64_bin.tar.gz

sudo mv jdk-13 /opt/
  sudo tee /etc/profile.d/jdk.sh <<EOF
  export JAVA_HOME=/opt/jdk-13
  export PATH=\$PATH:\$JAVA_HOME/bin
  EOF
  
source /etc/profile.d/jdk13.sh

echo $JAVA_HOME

java -version

### Second Approach to install java 13 along side other java versions
## Check this link https://medium.com/@ayeshajayasankha/how-to-install-and-switch-between-alternative-java-versions-66b3671fc382

curl -O https://download.java.net/java/GA/jdk13/5b8a42f3905b406298b72d750b6919f6/33/GPL/openjdk-13_linux-x64_bin.tar.gz
tar xvf openjdk-13_linux-x64_bin.tar.gz
export JAVA_HOME=<Directory where JAVA has been extracted>/jdk-13
export PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
. /etc/profile
sudo update-alternatives --install "/usr/bin/java" "java" "<Directory where JAVA has been extracted>/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "<Directory where JAVA has been extracted>/bin/javac" 1  
sudo update-alternatives --set java <Directory where JAVA has been extracted>/bin/java
sudo update-alternatives --set javac <Directory where JAVA has been extracted>/bin/javac
java -version
javac -version
  

Are there any code examples left?
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source