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?
I had exactly the same problem, to solve it, you can do one of two things:
Or
If the above are all correct, but the problem is still present, you need to check the system Registry, in HKEY_CURRENT_USER\Environment, to make sure the “PATH” key type is REG_EXPAND_SZ (not REG_SZ).