Boaris
Boaris

Reputation: 5216

'mvn' is not recognized as an internal or external command, operable program or batch file error in Windows 10

I have read similar questions about this problem but it is not working anyways.

I've extracted maven 3.3.3 to D:\Maven (Java already installed and works fine) then added 2 system variables:

Variable Value
M2 %M2_HOME%\bin
M2_HOME D:\Maven

I've also appended next in the path:

%M2%

But it is still not working.

I can execute mvn -version from the D:\Maven\bin but can't do this from another directory.

Upvotes: 3

Views: 43928

Answers (3)

Vignesh Ravichandran
Vignesh Ravichandran

Reputation: 189

One mistake I did was, There will two environment variables section

One can be accessed via admin while the other one doesn't require any. Please specify the paths in the second place

It will work for sure., also try echo %M2_HOME% to check whether you have configured correctly..before jumping to mvn install

Hope this helps for someone who has to use admin rights

Upvotes: 0

Rahul Jain
Rahul Jain

Reputation: 276

Try to put full maven path upto bin like "C:\Users\ABC\Downloads\maven-2.0.5-bin\maven-2.0.5\bin" directly into path variable of os, then you will be able to understand where problem exists.

Upvotes: 0

Bhuwan Prasad Upadhyay
Bhuwan Prasad Upadhyay

Reputation: 3056

Don't put extra space in your path after D:\Maven\bin; in D:\Maven\bin; D:\Program Files\NodeJS; Please don't make any space in path variable.

Normally, To set mvn in command line in windows :

  1. Set JAVA_HOME property in system environment
    eg. JAVA_HOME=C:\Program Files\Java\jdk1.8.0_65
  2. Set M2_HOME property in system environment
    eg. M2_HOME=D:\apache-maven-3.3.3
  3. Finally add maven to PATH

    ;%M2_HOME%\bin; add this at the end of PATH property of system environment

Now Try mvn -version

Upvotes: 8

Related Questions