I tried running ./gradlew
from an Android project directory, but I get an error of:
ERROR: JAVA_HOME is set to an invalid directory: /Library/Java/JavaVirtualMachines/jdk1.8.0_11.jdk/Contents/Home
Please set the JAVA_HOME variable in your environment to match the location of your Java installation.
Things I've tried:
Navigated to
/Library/Java/JavaVirtualMachines
.jdk1.8.0_11.jdk
exists, but so doesjdk1.7.0_79.jdk
which java
prints out/usr/bin/java
printenv
prints
...
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_11.jdk/Contents/Home JDK_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_11.jdk/Contents/Home
...
javac -version
printsjavac 1.8.0_11
which javac
prints/usr/bin/javac