I have installed SDKMAN! as root on my server and want all my users (developers) to have access to it.
For that I did:
export SDKMAN_DIR="/usr/local/sdkman" && curl -s "https://get.sdkman.io" | bash
source "/usr/local/sdkman/bin/sdkman-init.sh"
Then for a user, I added these lines at the end of .profile and .bashrc:
#THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!!
export SDKMAN_DIR="/usr/local/sdkman"
[[ -s "/usr/local/sdkman/bin/sdkman-init.sh" ]] && source "/usr/local/sdkman/bin/sdkman-init.sh"
From that user (non root), the sdk command works, but when I try to install Java, I get a lot of errors for folders and files permissions, that's OK because most of those where created by root, not by my current user.
Then I try:
sudo sdk install java 9.0.4-open
And got:
sudo: sdk: command not found
Not sure what I'm doing wrong, maybe I need to install SDKMAN! for each user on my server, which would be a pain.
Any suggestions?
It seems it is not possible to install SDKMAN! once as root and that be available for all users. I guess each user needs to install it and then each users needs to install it's own version of Java, which is a pain if I manage one server and need several users to have the same configuration.