Skip to content

Installing Adoptium Eclipse Temurin 17 on Ubuntu 22.04

The "Eclipse Temurin" recommend for OpenJDK binary distribution. It was released by Eclipse Adoptium which was before known as AdoptOpenJDK. If you are still confused about OpenJDK binary distribution, read this post.

I will guide you in installing Eclipse Temurin version 17, which is the latest LTS version, on Ubuntu 22.04. From the start till you could run the Java commands on the Terminal.

I also made an article for different Operating Systems:

Download and Install Eclipse Temurin

First, get the Eclipse Temurin installer from the Adoptium Website. The download button will choose an installer based on your Operating System. So, make sure to download .tar.gz file.

When it’s done, extract it.

$ cd Downloads
$ tar -xvzf OpenJDK17U-jdk_x64_linux_hotspot_17.0.4.1_1.tar.gz

Move to /opt

At this point, you could place the JDK folder anywhere. But, I prefer to put it under /opt directory. Plus rename the folder from jdk-17.0.4.1+1 to jdk-17. Trust me, it will help you later.

$ sudo mv jdk-17.0.4.1+1/ /opt/jdk-17

Set Up Environment Variables

Create a file with the name jdk.sh under /etc/profile.d.

$ sudo nano /etc/profile.d/jdk.sh

Fill the file with this value:

export JAVA_HOME=/opt/jdk-17
export PATH=$PATH:$JAVA_HOME/bin

Note: Remember when I mention renaming the folder? If you’re not following my advice, pay attention to using the correct folder name. I assume it should be jdk-17.0.4.1+1.

Last, you need to re-initiate the profile in order for the new Java environment set up recognized.

source /etc/profile

Now, you can verify the JAVA_HOME and java command on your Terminal.

Terminal

If you have any comments or corrections please feel free to email them to me. Also, if you found any of the content on this website useful consider buy me a coffee ;)