As it is not (yet) in the list of possibilities, there s also asdf.
asdf does not only provide version management for java, it has plugins for ~400 different languages and tools by default, you can find more on github, or create your own.
Here is an example how to setup a new install (you can also install completion so you don t have to list the versions first). The java plugin is added, a specific version (there are versions for adoptopenjdk
, corretto
, dragonwell
, graalvm
, liberica
, mandrel
, microsoft
, openjdk
, oracle
, sapmachine
, semeru
, temurin
, trava
, zulu
) is installed and configured to be the global (or local version) to use:
asdf plugin-add java # Add java Plugin
asdf list-all java # List all available java versions
asdf install java temurin-20.0.1+9 # Install specific jdk version
asdf install java temurin-17.0.7+7 # Install another jdk version
asdf global java temurin-17.0.7+7 # Set the global jdk version
asdf local java temurin-20.0.1+9 # Set the local version for calls from the current directory
asdf uses a file in $HOME/.tool-versions
to configure the global selected version. If you call any tool in a directory that has a .tool-versions
file with a different version, that one is used (defined with asdf local …
).