How to use sdkman to switch to java 17 :
Install sdk man
curl -s "https://get.sdkman.io" | bash
Open a new terminal
sdk install java 17.0.0-tem && sdk use java 17.0.0-tem
See troubleshooting section, below, if you faced any problem here.
Open a new terminal
java --version
Java version should be 17 now.
Troubleshoot
If you faced any problem running sdk, make sure your shell script is properly changed by sdkman installation :
cat $HOME/.bashrc
The above command should return a script, which at the end, contains :
#THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!!
export SDKMAN_DIR="$HOME/.sdkman"
[[ -s "$HOME/.sdkman/bin/sdkman-init.sh" ]] && source "$HOME/.sdkman/bin/sdkman-init.sh"
If not, use nano to edit.
nano ~/.bashrc
Same, do for zsh :
cat $HOME/.zshrc
It should be empty, non-existence or it should end with the same code as provided above. If not, use nano to edit.
nano ~/.zshrc
Comments