Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
506 views
Welcome To Ask or Share your Answers For Others

1 Answer

go to Java installation (C:Program FilesJavajdk ********) 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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...