Windows 7 environment variable not working in path

jiminssy picture jiminssy · Dec 31, 2011 · Viewed 105.9k times · Source

I am trying to set up some path using environment variable. I added an environment variable "MAVEN_HOME" with the value "C:\maven". Then in the path I added "%MAVEN_HOME%\bin;...rest". When I type "echo $MAVEN_HOME%" I get the correct "C:\maven" printed on the screen. But when I type "mvn" which is a batch file in the "bin" directory, it can't find it.

So, I manually added the entire path in PATH. "C:\maven\bin;...rest" and it was able to find "mvn" and execute it.

Could someone help me what I did wrong?

Answer

Daniel Bonetti picture Daniel Bonetti · Oct 23, 2012

Check if there is a space character between the previous path and the next:

Incorrect: c:\path1; c:\Maven\bin\; c:\path2\

Correct: c:\path1;c:\Maven\bin\;c:\path2\