在 IntelliJ IDEA 中,使用 Gradle 窗口我可以执行任何和所有 Gradle 任务。但是,当我尝试通过 IDE 中的终端窗口执行相同的任务时,出现以下错误:
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.
Run Code Online (Sandbox Code Playgroud)
使用 gradle 和 gradlew 时会发生这种情况。在 IntelliJ -> File -> Project Structure -> Project 然后 SDK 正确设置为 1.8。任何解决此问题的建议,以便我可以使用终端执行 Gradle 任务,将不胜感激。