Java

Install Java 9 on Ubuntu


This tutorial will show how to install Java 9 on Ubuntu and validate the setup to make sure the necessary environment variables for development are set.

Installation

In Ubuntu terminal, add the repository where Java 9 installation packages can be found. It’s the same repository where you can find the Java 8 installation packages:

sudo add-apt-repository ppa:webupd8team/java

Update the packages list with the newly added repository and install the Java 9:

sudo apt-get update
sudo apt-get install oracle-java9-installer

Note that the download may take a while since the Java 9 installer is considerably bigger than the previous versions.

Additionally, during the installation process, you must confirm the Java 9 download and accept the licence agreement. After the confirmations, wait until the installation process is complete.

Environment Variables and Validation

The installation through the above steps often automatically performs the necessary changes on the environment for Java development on Ubuntu, so unlike Windows, you shouldn’t need to manually set up any environment variables.

So, let’s validate the installation with the following commands:

java -version
java version "9"
Java(TM) SE Runtime Environment (build 9+181)
Java HotSpot(TM) 64-Bit Server VM (build 9+181, mixed mode)
javac -version
javac 9

I hope it helps.
Cya!

bgasparotto

Recent Posts

Python function decorator

This guide will show you how to create a Python function decorator with a few…

2 years ago

Got permission denied while trying to connect to the Docker daemon socket

This guide will show you how to fix the error Got permission denied while trying…

2 years ago

Python virtual environment on Intellij IDEA

This guide will show you how to create a Python virtual environment on Intellij IDEA…

2 years ago

Find and kill processes on Linux and Mac by port number

This tutorial will quickly show you how to to find and kill processes on Linux,…

2 years ago

Python: Relocation R_X86_64_PC32 against symbol can not be used when making a shared object Error

This guide shows a possible solution for Python error Relocation R_X86_64_PC32 against symbol can not…

2 years ago

Kubernetes useful commands

I condensed below a cheat sheet of Kubernetes useful commands. I will keep updating this…

2 years ago