‘mvn’ is not recognized as an internal or external command, operable program or batch file


May be question is asked before but i found very strange kind of error.
When I run mvn --version command from bin its gives the version and the other information. However when I run outside bin it gives exception. Both the result mention below

C:Program Filesapache-maven-3.0.5-binapache-maven-3.0.5bin>mvn --version
Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 19:21:
Maven home: C:Program Filesapache-maven-3.0.5-binapache-maven-3.0.5
Java version: 1.7.0_25, vendor: Oracle Corporation
Java home: C:Program FilesJavajdk1.7.0_25jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"

C:Program Filesapache-maven-3.0.5-binapache-maven-3.0.5>mvn --version
'mvn' is not recognized as an internal or external command,
operable program or batch file.

Also i set JAVA_HOME in user variable and M2_HOME, M2 in system environment variable. The output for these variables and %path% is:

C:Program FilesJavajdk1.7.0_25

C:UsersSAHILBHALLA>echo %M2%
C:Program Filesapache-maven-3.0.5-binapache-maven-3.0.5bin

C:Program Filesapache-maven-3.0.5-binapache-maven-3.0.5

C:UsersSAHILBHALLA>echo %path% 
C:Program Files (x86)InteliCLS Client;C:Program FilesInteliCLS Client;C:Windowssystem32;C:Windows;C:WindowsSystem32Wbem;C:WindowsSystem32WindowsPow erShellv1.0;C:Program FilesJavajdk1.7.0_25bin;.; 

Tell me where i am wrong. What should i do recover from it?


My problem solved, path didn’t resolve %M2%. When i added location of maven-bin in the path instead of %M2% after that commands works.

I would like to thanks to all those who try to solve the problem

Source: StackOverflow.com

Leave a Reply

Your email address will not be published. Required fields are marked *