Reputation: 486
To start the my project in windows i have to set the java environmental variable in cmd using below command
set JAVA_HOME = D:\Java\jdk1.7.0
but it didn't set the environment variable, i don't know what the issue.After pending couple hours i find the reason that is due to white space on both side of = symbol.Because of this environmental variable not getting set and i changed by command to
set JAVA_HOME=D:\Java\jdk1.7.0
after that it is working fine.
My question is why this both command are not equal?
Upvotes: 2
Views: 381
Reputation: 6695
The set
command is aware of spaces. When you issue the command
set JAVA_HOME = D:\Java\jdk1.7.0
you actually set the variable JAVA_HOME␣
to value ␣D:\Java\jdk1.7.0
. Note the spaces: ␣
!
You can check it using the following way:
> echo [%JAVA_HOME%]
[%JAVA_HOME%]
> echo [%JAVA_HOME %]
[ D:\Java\jdk1.7.0]
The brackets are included in order to highlight spaces, they are not important by themselves.
Upvotes: 4