Skip to content

Switching to Java 17

Chris Norman edited this page Feb 22, 2023 · 1 revision

Java 17

Picard 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.

We have tested Picard with the Adoptium JDK known as temurin. To install temurin with brew, 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-14 at 2 20 29 PM

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.