如果你的在ubuntu下运行gradle命令出现如下状况,请尝试一下解决方案:
# gradle
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.
sudo ln -s /usr/lib/jvm/java-8-oracle /usr/lib/jvm/default-java
将你的jdk关联到gradle要求的目录中去
$ sudo gedit ~/.bashrc 查看环境变量设置
$ source ~/.bashrc 使设置的环境变量生效
$ echo $JAVA_HOME 查看java环境变量的设置