I've followed the official installation instructions here for Windows XP. But sometimes when I execute mvn --version
, I receive the error message,
'mvn' not recognized as an internal or external command
I've even rebooted my machine a couple times, but the OS does not always recognize the maven command. But when I execute either, cd %M2_HOME%
, or cd %M2%
it brings me to the installation directory. I've also made sure to add the user variable M2
to the Path
system variable.
So, what gives?
Running command prompt as Administrator solved the problem for me. I did not have to move M2 or M2_HOME under system variables.
I solved this by creating all under user variables (including the
PATH
variable). This is because the system variables do not "translate" the user variables. So if you only want to use maven in your account, you need to add anotherPATH
variable as a user variable, not system variable.As others have done, creating new System variables M2 and M2_HOME solved the problem. Just making User variables M2 and M2_HOME on my Windows XP machine led to maven not being recognised from the command line. I then deleted the User variables, created copies as System variables and it all came to life.
This was apache-maven-3.0.4 with XP sp3. So the instructions in: http://maven.apache.org/download.cgi seem incorrect.
same problem.
and I solved it by:
and then
mvn --version
works.