

# Add key=value pairs of SDKs to use below # Enable auto-env through the sdkman_auto_env config OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.8+10, mixed mode) OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.8+10) Using java version 11.0.8.hs-adpt in this shell. Project-dir $ sdk use java 11.0.8.hs-adpt OpenJDK Runtime Environment AdoptOpenJDK (build 15+36)Įclipse OpenJ9 VM AdoptOpenJDK (build openj9-0.22.0, JRE 15 Mac OS X amd64-64-Bit Compressed References 20200922_45 (JIT enabled, AOT enabled) We first change it to Java 11 and then run env init to set Java 11 as default version for our projec directory: In the following shell output we have a Java 15 version set as default. It is a text file so we can change the Java version in the file, or regenerate the file by running the env init command again, but with a different active Java version. The file contains the Java version that was active when we invoked the env init command. To support automatic switching of a Java version we must first run the env init command in the directory of our project. This is very useful when we have to work on multiple projects on our computer and each project requires a specific Java version to be used. But we can even automatically switch to a specific installed Java version when we enter a directory. With the use command we can switch between version in the current shell we are working in. SDKMAN! will take care of downloading the Java version and setting all the correct system variables to use that Java version.

When we look at Java we can use a simple install java command from the command-line to install a version of Java on our computer. There are a lot of SDKs supported by SDKMAN!: Java, Groovy, Kotlin, Scala, Gradle, Maven, Leiningen, Micronaut, Grails, Vert.x, JBake, AsciidoctorJ and more. SDKMAN! is a very useful tool to manage versions of so-called software development kits.
