Intellij Gradle terminal ERROR: JAVA_HOME is not set
go to Java installation (C:\Program Files\Java\jdk ********) and copy the address file. Right click the "my computer" select "Properties" or go to "Control Panel > System and Security > System". Select "Advanced system settings" then click the "Environment Variables" button. Click System Variables, New write Variable Name to "JAVA_HOME" and write Variable Value to Java installation folder address then click OK finish it.
You need an environment variable set for this to work. You can simply type in the command line:
export JAVA_HOME=<PATH to your Java Home>
Or you can put that line in your .rc file. On a mac you can do this:
export JAVA_HOME=`/usr/libexec/java_home`
More information can be found here: http://javarevisited.blogspot.com/2012/02/how-to-set-javahome-environment-in.html