简体   繁体   中英

Why is it required to mention JAVA_HOME path in double quotes when setting environment variable in windows

I am setting environment variables in windows Java_Home path using cmd. when I use SETX JAVA_HOME C:\\Program Files\\Java\\jdk1.6.0_07 it gives me error as Invalid syntax. But when I use SETX JAVA_HOME "C:\\Program Files\\Java\\jdk1.6.0_07" it is set successfully.

When I set SETX HOME C:\\Users\\Default it sets successfully without double quotes. So why do we need double quotes only for JAVA_HOME and not for HOME ?

Because "Program Files" contains a space. And I believe you mean

set "JAVA_HOME=C:\Program Files\Java\jdk1.6.0_07"

But Java 1.6.0 is unsupported (since February 2013), you should upgrade. Java 7 is EOL in April 2015 , so I think it might be best to consider Java 8.

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