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?
Tried following steps to recover my variables successfully on my Windows 7. Go to "My Computer" properties -> "Advanced system settings" -> click on "Advanced" tab -> click on "Environment Variables" button -> Edit "PATH" variable and paste everything copied in the third step in -> Variable value: box.
PATH is an environment variable that holds all the executable shell commands. When you type something in the command prompt, it will go through all the path and search for the match of the command line utility name you have just entered.
To add a path to the PATH environment variableIn the System dialog box, click Advanced system settings. On the Advanced tab of the System Properties dialog box, click Environment Variables. In the System Variables box of the Environment Variables dialog box, scroll to Path and select it.
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\
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With