Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'gradle' is currently not installed. though gradle is already installed in system

Tags:

Installed gradle using

sudo apt-get install gradle

After installation, used command

gradle build 

It gives error

The program 'gradle' is currently not installed. You can install it by typing:

sudo apt-get install gradle

Also followed steps given here:http://exponential.io/blog/2015/03/30/install-gradle-on-ubuntu-linux/. But everytime it gives same error and can not move forward.

Please suggest what is wrong is happening

like image 228
Mahesh Techcompose Avatar asked Apr 30 '16 10:04

Mahesh Techcompose


1 Answers

This question is now almost a year old but I chanced on it having run into a similar issue so perhaps the following will help.

I encountered the problem after upgrading gradle to a more recent version. The upgrade installed fine and even ran once, but subsequent calls gave me:

The program 'gradle' is currently not installed. You can install it by typing:
sudo apt install gradle

I tried to reinstall but Ubuntu was having none of it:

gradle is already the newest version (3.5-0ubuntu1).

So I had a look at where the installer had put it:

whereis gradle
gradle: /usr/lib/gradle

Aha! This is a directory, not a path to an executable. Listing the contents of this directory gave me:

total 28
drwxr-xr-x   3 root root  4096 Apr 18 11:59 ./
drwxr-xr-x 125 root root 20480 Apr 18 12:17 ../
drwxr-xr-x   6 root root  4096 Apr 18 11:57 3.5/
lrwxrwxrwx   1 root root    19 Apr 18 11:59 default -> /usr/lib/gradle/3.5/

... and within the 3.5 directory we find the sub-directory bin and the executable gradle.

Conclusion: Ubuntu took a funny turn during the upgrade and deleted what was probably a symbolic link to the executable.

Solution: create a symbolic link to the executable, taking care to ensure that it's on your PATH.

sudo ln -s /usr/lib/gradle/default/bin/gradle /usr/bin/gradle

Finally test that it works:

gradle --version

------------------------------------------------------------
Gradle 3.5
------------------------------------------------------------
like image 149
jonnyp Avatar answered Sep 29 '22 06:09

jonnyp