Wednesday, June 24, 2020

Install JDK (OpenJDK) on Ubuntu 20.04

Install JDK 14.0.1 (from Oracle) on Ubuntu 20.04

- Visit to download latest JDK of Linux/x64, currently openjdk-14.0.1_linux-x64_bin.tar.gz

- Extract the downloaded file:
$ tar -zxvf openjdk-14.0.1_linux-x64_bin.tar.gz

-  Create a folder in /opt/java where jdk will be stored.
$ sudo mkdir -p /opt/java

- Move the extracted folder to /opt/java
$ sudo mv jdk-14.0.1 /opt/java

- Set default java and javac using update-alternatives:
$ sudo update-alternatives --install /usr/bin/javac javac /opt/java/jdk-14.0.1/bin/javac 1
$ sudo update-alternatives --install /usr/bin/java java /opt/java/jdk-14.0.1/bin/java 1
$ sudo update-alternatives --config javac
$ sudo update-alternatives --config java

No comments:

Post a Comment