简体   繁体   中英

How to set JAVA_HOME environment variable in Intelli J

I'm on windows and have set the environment JDK for the intelli J project to jdk 1.8 as well as the path for JAVA_HOME in the system variable setting to the jdk 1.8 path however when I try to use "gradle build" in the local terminal in intelli j it tells me

"ERROR: JAVA_HOME is set to an invalid directory: C:\\Program Files\\Java\\jdk-10.0.2

Please set the JAVA_HOME variable in your environment to match the location of your Java installation."

When I buil the project in cmd prompt it works fine however I'd like to be able to do it in the local terminal. Is there a command to let me set the path for JAVA_HOME through the intelli j terminal?

You can find it out at Selecting-the-JDK-version-the-IDE-will-run-under

Try also to see the environment variables settings. Go to windows environment variables -> under system variables, seek for the varaible "JAVA_HOME" -> see the value and edit if its wrong path

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