In Ubuntu 14.04 i have installed gradle using sdkman. When I execute "which gradle" in terminal from my primary account it shows path of gradle. Now I have another account hadoop having hduser, so after switching to hduser it is showing gradle is not installed. What should I do? How can I set path of gradle for hduser?
-
Don't know how sdkman installs it but normally you would just add it to the PATH environment variable for the other user. – Henry Oct 24 '16 at 04:17
-
The answer by @marvi is correct, just in case someone forget to specify the default version, sdkman wont always make the installed version the default one for Gradle. – Ibrahim.H Oct 07 '22 at 10:40
5 Answers
sdkman installs software only for your current user (placed under $HOME/.sdkman
). When you login as another user you will not have access to them. sdkman has init scripts called from your .bashrc/.zshrc that will append to your PATH. On my account gradle is /Users/marvi/.sdkman/candidates/gradle/current/bin/gradle
.
For a multi user install I would do a manual install. First option here: http://howtoprogram.xyz/2016/09/06/install-gradle-ubuntu-16-04/

- 186
- 2
- 7
The simplest solution is to use command:
whereis gradle

- 5,889
- 34
- 34
-
4For me that command dose not return anything. It's just blank. – Michael Sørensen Jan 08 '21 at 22:32
For me the solution was simply setting the default version of Gradle to 7.6 with sdk use gradle 7.6
and reloading my ZSH config with source ~/.zshrc
.
It seems like SDKMAN doesn't set a Gradle by default, you must do it yourself.

- 733
- 2
- 9
- 20
One alternative would be install SDKMan as a shared component
export SDKMAN_DIR="/usr/local/sdkman" && curl -s "https://get.sdkman.io" | bash
Then install shared SDK component, i.e. gradle
sdk install gradle 4.10.2
Then for each user you want access to this 'shared' SDKs, just edit .bashrc
or .profile
file on the home path of those user and append these lines
export SDKMAN_DIR="/usr/local/sdkman"
[[ -s "/usr/local/sdkman/bin/sdkman-init.sh" ]] && source "/usr/local/sdkman/bin/sdkman-init.sh"
They should have instant access to shared gradle after next login, test it with gradle -v

- 1,716
- 14
- 12
-
After installing it the way you suggested I receive the error `tee: /usr/local/sdkman/var/broadcast_id: Permission denied tee: /usr/local/sdkman/var/broadcast: Permission denied` – Josh Correia May 28 '19 at 14:04
I had the same error, I just moved into the candidates directory and used chmod.
(xenial)lerie@localhost:~/.sdkman/candidates$ sudo chmod u+x -R .
(xenial)lerie@localhost:~/.sdkman/candidates$ gradle
Welcome to Gradle 7.0!
Here are the highlights of this release:
- File system watching enabled by default
- Support for running with and building Java 16 projects
- Native support for Apple Silicon processors
- Dependency catalog feature preview
For more details see https://docs.gradle.org/7.0/release-notes.html
Starting a Gradle Daemon (subsequent builds will be faster)
> Starting Daemon

- 26
- 6