Skip to content

Installing Java 17.0.9#

Essential for the development and execution of this workshop is the Java Development Kit (JDK).[^1] The JDK includes several tools such as a compiler (javac), a virtual machine, a documentation generator (JavaDoc), monitoring tools (Visual VM), and so on[^2]. The code in this workshop uses JDK {jdk-version}.

Installing the JDK#

To install the JDK 17.0.9, follows the instructions from Adoptium Installation to download and install the JDK for your platform.

For Mac OS X#

There is also an easier way to download and install Java if you are on Mac OS X: using SDKMAN! (SDKMAN!) is a tool for managing parallel versions of multiple Software Development Kits (SDK) on most Unix-based systems. It provides a convenient Command Line Interface (CLI) and API for installing, switching, removing, and listing Candidates. Developers often need to manage parallel versions of different builds of SDKs in their environment and switch from one to another. Manually setting the PATH variable can become quickly painful. That’s when SDKMAN! can help you.

Installing SDKMAN!#

Installing SDKMAN! is easy. On Bash and ZSH shells simply open a new terminal and enter:

$ curl -s "https://get.sdkman.io" | bash

Follow the instructions on-screen to complete installation.

Listing Java Versions To install Java, we need to list the available versions on SDKMAN! using the list command. The result is a table of entries grouped by the vendor and sorted by version:

$ sdk list java

If you have any Java candidate installed, you should see installed in the Status column. If you don’t have any Java candidate installed, use SDKMAN! to install one or several.

Installing Java 17.0.9#

There are several different vendors of Java, and each vendor has its own distribution. Most of these distributions are available on SDKMAN! and can easily be installed. Let’s install Temurin.

To install Temurin 17.0.9, we copy its identifier (17.0.9-tem), which is the version from the table, and we add it as an argument in the install command:

$ sdk install java 17.0.9-tem

Downloading: java 17.0.9-tem
Repackaging Java 17.0.9-tem...
Installing: java 17.0.9-tem
Done installing!
Do you want java 17.0.9-tem to be set as default? (Y/n):

For Linux#

For Linux distributions, there are also packaged Java installations.

For rpm-based systems (e.g., Fedora):

dnf install java-17.0.9-openjdk

For Debian-based distributions (e.g., Ubuntu):

$ apt-get install openjdk-17.0.9-jdk

Checking for Java Installation#

Once the installation is complete, it is necessary to set the JAVA_HOME variable and the $JAVA_HOME/bin directory to the PATH environment variable. Check that your system recognizes Java by entering java -version and the Java compiler with javac -version.

$ java -version
openjdk version "17.0.5" 2022-10-18
$ javac -version
javac 17.0.5