In IntelliJ IDEA, using the Gradle window I am able to execute any and all Gradle tasks. However, when I try and execute the same tasks through the terminal window within the IDE, it hits me with the following error:
ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.
This occurs when using gradle and gradlew. In IntelliJ -> File -> Project Structure -> Project then SDK is set correctly to 1.8. Any suggestions for resolving this so I can use the terminal to execute Gradle tasks would be greatly appreciated.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With