-
Terminal window sdk install java 21.ea.35-openInstalls Java 21.
-
Terminal window java --versionCheck Java installation.
Switching to a specific Java version in different projects
Suppose you have multiple projects that require different Java versions.
Project 1 uses Java 21.ea.35.
Project 2 uses Java 22.ea.29.
- project-1/ - ... - project-2/ - ...-
Add
.sdkmanrcfiles with the required Java versions to the project directories.project-1/.sdkmanrc java=21.ea.35-openproject-2/.sdkmanrc java=22.ea.29-open- project-1/- .sdkmanrc- project-2/- .sdkmanrc -
Enable switching SDK versions automatically when you
cdinto a directory~/.sdkman/etc/config ...sdkman_auto_env=true...
After setting up the .sdkmanrc files, SDKMAN! will automatically switch to the required Java version when you cd into the project directories.
If specified Java version is not installed, SDKMAN! will prompt you to install it.
Run sdk env install to install it.