After installation of CentOS 8 at my system, I decided to install java using sdkman. So i simply follow the instruction from https://sdkman.io/install
I successfully configured sdkman and also install latest version of jdk. javac and java both are working well in current user. but when i switch to another user both java and javac are not available.
The problem is that everything installed in home directory of current user. for other user sdkman is not available.
After sometimes i found the solution which solved my problem. I have decided to install sdkman globally, which is available for all users.
After that edit .bashrc, .bash_profile or .profile file and remove sdkman environment settings.
I successfully configured sdkman and also install latest version of jdk. javac and java both are working well in current user. but when i switch to another user both java and javac are not available.
The problem is that everything installed in home directory of current user. for other user sdkman is not available.
After sometimes i found the solution which solved my problem. I have decided to install sdkman globally, which is available for all users.
1. Uninstall sdkman - if you already install it.
Uninstall done into three steps 1. take backup of installed sdkman and then remove it.
$ tar zcvf ~/sdkman-backup_$(date +%F-%kh%M).tar.gz -C ~/ .sdkman $ rm -rf ~/.sdkman
After that edit .bashrc, .bash_profile or .profile file and remove sdkman environment settings.
2. Install sdkman to custom location
Decide the location where you want to install sdkman. In my case i install all the software in /opt directory. So I installed it under /opt/local/sdkman.
enter the following command.
$ export SDKMAN_DIR="/opt/local/sdkman" && curl -s "https://get.sdkman.io" | bash
3. Create sdkman.sh inside /etc/profile.d/ directory
create sdkman.sh under profile.d directory and add following lines.
#THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!!
export SDKMAN_DIR="/opt/local/sdkman"
[[ -s "/opt/local/sdkman/bin/sdkman-init.sh" ]] && source "/opt/local/sdkman/bin/sdkman-init.sh"
# vim /etc/profile.d/sdkman.sh
#THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!! export SDKMAN_DIR="/opt/local/sdkman" [[ -s "/opt/local/sdkman/bin/sdkman-init.sh" ]] && source "/opt/local/sdkman/bin/sdkman-init.sh"
# source /etc/profile
SDKMAN available for all the user enjoy :)
No comments:
Post a Comment