Java installation on Ubuntu 20.04
Oracle JRE under Ubuntu focal using linuxuprising/java
- Current configuration
- Download Oracle JDK 11
- Installation via linuxuprising/java
- Check
- Environment variable
Following these instructions: https://www.digitalocean.com/community/tutorials/how-to-install-java-with-apt-on-ubuntu-20-04-fr.
!java --version
From https://launchpad.net/~linuxuprising/+archive/ubuntu/java/+packages, I can identify the focal version:
oracle-java11-installer-local - 11.0.9-1~linuxuprising0 (changes file) logix2 2020-10-22 Published Focal Java
I download the given version from Oracle website: https://www.oracle.com/java/technologies/javase-jdk11-downloads.html. Java SE Development Kit 11.0.9 Linux x64 Compressed Archive
And yes you have to login with an oracle account to download it.
sudo add-apt-repository ppa:linuxuprising/java
sudo apt update
sudo mkdir -p /var/cache/oracle-jdk11-installer-local/
sudo cp ~/Downloads/jdk-11.0.9_linux-x64_bin.tar.gz /var/cache/oracle-jdk11-installer-local/
sudo apt install oracle-java11-installer-local
After accepting the license agreement, installation is running
$ sudo update-alternatives --config java
There are 2 choices for the alternative java (providing /usr/bin/java).
Selection Path Priority Status
------------------------------------------------------------
0 /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1111 auto mode
1 /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1111 manual mode
* 2 /usr/lib/jvm/java-11-oracle/bin/java 1091 manual mode
Enter /usr/lib/jvm/java-11-oracle
as your JAVA_HOME variable in /etc/environment
$ cat /etc/environment
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin"
JAVA_HOME="/usr/lib/jvm/java-11-oracle"
$ source /etc/environment
$ echo $JAVA_HOME
/usr/lib/jvm/java-11-oracle