Ubuntu OpenJDK 8 support ended on April 2021*. It is encouraged to migrate from the Ubuntu OpenJDK to an alternative OpenJDK distribution like Eclipse Temurin 8 from Adoptium which will be supported until 2026.
(* Despite the end-of-support declaration, Ubuntu updated OpenJDK 8 to the patch release 8u312 on 2021-12-17. It is unclear whether there will be further updates.)
This document describes two ways, manual or with package manager, to install Eclipse Temurin 8 on your Ubuntu system.
These instructions require X-Road version 6.26.0 or later.
Installing with package manager (apt)
These instructions refer to the old AdoptOpenJDK packages and will be updated once the new Eclipse Temurin packages are available.
See https://github.com/adoptium/installer/issues/330
(See https://adoptopenjdk.net/installation.html?variant=openjdk8&jvmVariant=hotspot#linux-pkg)
1. Import the AdoptOpenJDK GPG key
wget -qO - https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public | sudo apt-key add -
2. Configure AdoptOpenJDK's apt repository
echo "deb https://adoptopenjdk.jfrog.io/adoptopenjdk/deb $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/adoptopenjdk.list
For example, if you are running Ubuntu 20.04 (Focal Fossa) the above command would be equivalent to:echo "deb https://adoptopenjdk.jfrog.io/adoptopenjdk/deb focal main" | sudo tee /etc/apt/sources.list.d/adoptopenjdk.list
3. Install the Java runtime environment
sudo apt update && sudo apt install adoptopenjdk-8-hotspot-jre
4. Check the installation path.
dpkg -L adoptopenjdk-8-hotspot-jre | grep 'java$'
In this case it is /usr/lib/jvm/adoptopenjdk-8-hotspot-jre-amd64
5. Set Java home path in /etc/xroad/services/local.conf
JAVA_HOME=/usr/lib/jvm/adoptopenjdk-8-hotspot-jre-amd64
Installing manually
Note that manual installs are not automatically updated.
See also: https://adoptium.net/installation.html?variant=openjdk8&jvmVariant=hotspot#x64_linux-jre
For example installing latest Java 8 into the /opt
directory (uses the Adoptium API to get the link to latest version available)
cd /opt wget -O temurin-8-jre.tar.gz https://api.adoptium.net/v3/binary/latest/8/ga/linux/x64/jre/hotspot/normal/eclipse tar xvf temurin-8-jre.tar.gz # take note of the output directory, e.g ./jdk8u312-b07-jre rm temurin-8-jre.tar.gz
2. Set the Java home path in /etc/xroad/services/local.conf
JAVA_HOME=/opt/jdk8u312-b07-jre
Optional steps
Removing the old Java distribution
Note that if you used the manual installation method, removing the Ubuntu OpenJDK package is not possible since the security server depends on it. You need to be sure that it is safe to remove the old Java distribution e.g. that it is not used by any other software you might have installed.
If Java was installed by package manager, remove it with the package manager
sudo apt remove openjdk-8-jdk
If you are removing Java manually, you need to locate it first. Checking from these directories might help/usr/lib/jvm/
/opt/
/usr/local/
Related articles