简体   繁体   中英

Terminal in Intellij IDEA does not have JAVA_HOME and java command

I have my command prompt (cmd) and it does show everything even if I go to the same path i'm in Intellij, but in Intellij java command and JAVA_HOME environment variable isn't set.

I have set environment variables in system as well as in user settings (Win 10)

Here is output of terminal from intellij:

D:\IdeaProjects\(Project)>java -version
'java' is not recognized as an internal or external command,
operable program or batch file.


D:\IdeaProjects\AirbentPluginIF>gradlew dokka

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.

While output of cmd:

D:\IdeaProjects\AirbentPluginIF>java -version
java version "11.0.2" 2019-01-15 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.2+9-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.2+9-LTS, mixed mode)


D:\IdeaProjects\AirbentPluginIF>gradlew dokka
Starting a Gradle Daemon, 1 stopped Daemon could not be reused, use --status for details

> Task :dokka
... (more stuffs)

What could be the reason for this?

In Environment Variables under Preferences/Tools/Terminal , try setting the value as:

JAVA_HOME=path to your java home

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM