Installing Gradle on Ubuntu

from beautifuldecay.com

It will be a small post, just to help someone who is navigating in the web without hope =D.

Firstly, you don’t need to go to the Gradle web site and download from there. You can just use the apt-get from cwchien repository:


sudo add-apt-repository ppa:cwchien/gradle
sudo apt-get update
sudo apt-get install gradle

After that, you can try to see the version of your installed gradle:

gradle -version

If the gradle version be showed, is everything ok, but probably you gonna see this message below:

ERROR: JAVA_HOME is set to an invalid directory: /usr/lib/jvm/default-java

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.

Even if you try to define the JAVA_HOME as java installation default path on Ubuntu (e.g. /usr/lib/jvm/java-7-oracle), the gradle still doesn’t working. The only way that I found to fix it is renaming the java folder (java-7-oracle) to “default-java” where gradle expect to find the java in. You can do it executing this command:

sudo ln -s /usr/lib/jvm/java-7-oracle /usr/lib/jvm/default-java

And now, after gradle -version, you gonna see something like that:

Gradle 2.9
————————————————————

Build time: 2015-11-17 07:02:17 UTC
Build number: none
Revision: b463d7980c40d44c4657dc80025275b84a29e31f

Groovy: 2.4.4
Ant: Apache Ant(TM) version 1.9.3 compiled on December 23 2013
JVM: 1.7.0_80 (Oracle Corporation 24.80-b11)
OS: Linux 3.19.0-39-generic amd64

Deixe um comentário

Preencha os seus dados abaixo ou clique em um ícone para log in:

Logo do WordPress.com

Você está comentando utilizando sua conta WordPress.com. Sair /  Alterar )

Imagem do Twitter

Você está comentando utilizando sua conta Twitter. Sair /  Alterar )

Foto do Facebook

Você está comentando utilizando sua conta Facebook. Sair /  Alterar )

Conectando a %s