Skip to content

Switching to Java 17

Chris Norman edited this page Feb 28, 2023 · 7 revisions

Java 17

GATK now requires Java 17 to both build and run, so you’ll need to install a version 17 JDK. I’d recommend using homebrew to install JDKs on Macs, and jenv to manage Java versions on the command line. jenv is especially handy if you need to switch between projects that use different versions of Java.

GATK is tested with the Adoptium JDK known as temurin. To install temurin with homebrew, do:

brew tap homebrew/cask-versions

brew install --cask temurin17

IntelliJ:

There are several settings in IntelliJ where you may need to make changes.

1) Project structure:

Go to File/Project Structure. Make sure the "SDKs" section includes your version 17 JDK:

Screen Shot 2023-02-14 at 2 21 59 PM

Then choose “Project” under “Project Settings”. You’ll need to update both “SDK” (point to your local Java 17 JDK), and “Language Level” (choose "17 - Sealed types, always strict floating point semantics"):

Screen Shot 2023-02-28 at 9 13 55 AM

2) Java plugin:

Go to Preferences/Build, Execution, Deployment/Compiler/Java Compiler:

Screen Shot 2023-02-14 at 2 14 13 PM

Set the "project bytecode version" to 17.

3) Gradle plugin:

Go to Preferences/Build, Execution, Deployment/Build Tools/Gradle. Update the “Gradle JVM” to use a Java 17 JVM. If you don’t do this, you may get errors when refreshing build.gradle.

Screen Shot 2023-02-14 at 2 15 51 PM

Make sure to refresh gradle in the gradle tab after making these changes.

New Java Features

Here are a couple of articles that include a survey of some of the new features available since Java 8 (written by Phil Shapiro):