I follow to this https://sdkman.io/install to install install sdkman. After instillation all worked nice. I can see correct version by sdk version. Also I can install various Java version. But all are for the correct shell session. As soon as I close and open new shell, I can't get neither sdkman nor those installed JDK. I can see all JDK at ~/.sdkman/candidates/java
. I have to run this all the time source "$HOME/.sdkman/bin/sdkman-init.sh"
How do I set sdkman as well as JDK permanent in my system.
When you run sdkman, at some point it printed some instructions to add a couple of lines to your shell rc file, so it would be activated with all shells.
For example, I have this at the end of my ~/.zshrc
(might differ from bash)
export SDKMAN_DIR="$HOME/.sdkman"
[[ -s "$HOME/.sdkman/bin/sdkman-init.sh" ]] && source "$HOME/.sdkman/bin/sdkman-init.sh"