manpreetSingh
manpreetSingh

Reputation: 724

mvn' is not recognized as an internal or external command

I have created these variables with their respective values, but even after doing this, command prompt is not recognizing mvn command
System Variables:

Upvotes: 1

Views: 26605

Answers (10)

EggHead
EggHead

Reputation: 1

I was using %MAVEN_HOME% in the variable path and it was giving problem, even though echo %MAVEN_HOME% command was showing the right path.

I changed it to C:\Program Files\apache-maven-3.6.1\bin in the path (Depends on your version of-course) and it worked like a charm.

Upvotes: 0

Sreelekshmi V
Sreelekshmi V

Reputation: 151

I had the same issue.

What I did to resolve this is creating M2_HOME & MAVEN_HOME. Also, edit Path variable value.

Created two System variables M2_HOME and MAVEN_HOME

enter image description here

enter image description here

enter image description here

New ->C:\Program Files\Apache Software Foundation\apache-maven-3.6.0\bin

where Apache Software Foundation is a folder I created to extract the apache-maven-3.6.0-bin.zip file.

Also, make sure Java is working fine and JAVA_HOME is properly set.

enter image description here

Upvotes: 2

cliftonf
cliftonf

Reputation: 67

In my case, for reasons I cannot explain, it made a difference to windows 7 if the MAVEN_HOME environment variable was defined in "System Variables" vs "User Variables".

I originally had both JAVA_HOME and MAVEN_HOME as "User Variables" and "Java -version" worked but windows could not find mvn (My path variable looked like this in both cases "Path=C:\Program Files\Java\jre1.8.0_144\bin;E:\Clif\Java\apache-maven-3.6.0\bin;")

Once I changed both Environment variables from "User Variables" to "System Variables" windows was able to find mvn.

Upvotes: 0

Derrick Hall
Derrick Hall

Reputation: 1

Make sure to set the path under the System Variables and not User Variables.

Upvotes: 0

Paolo
Paolo

Reputation: 3713

I think you have a typo:

change

name: M2
value: %M2_HOME%/bin;

to

name: M2
value: %M2_HOME%\bin;

if it doesn't work change %M2_HOME%\bin with the path. in this case:

C:\Program Files\apache-maven-3.2.1\bin

Upvotes: 0

LazloBolivia
LazloBolivia

Reputation: 11

Hello I had the same problem and I figured it out that I was including some space characters on the "path" next to the ; just by removing the space character I was able to have everything working properly"

Upvotes: 1

shaosh
shaosh

Reputation: 687

I have a very difficult time to solve this problem. It did not work no matter how I set up the environment variables in the control panel of Win7.

My final solution is to set the variables via the cmd.

set M2_HOME "D:\Program Files\Maven\apache-maven-3.3.3"
set M2=%M2_HOME%\bin
set path=%path%;%M2%

Upvotes: 0

Gab
Gab

Reputation: 8323

try :

  • to restart the command prompt
  • to start the command prompt with run/cmd instead of shift+right-click -"open command window here"
  • to put the system path between double quote to manage espace character
  • to replace C:\Program Files\ per C:\PROGRA~1\

edit

this is my own config :

MAVEN_HOME="C:\Program Files\apache-maven-3.2.1"

PATH=XXX;%MAVEN_HOME%\bin;XXX

Upvotes: 1

user11153
user11153

Reputation: 8876

From Maven documentation page:

Maven, like many cross-platform tools, can encounter problems when there are space characters in important pathnames. The instructions below will remind you of this for several particular items.

You have Maven installed in C:\Program Files\apache-maven-3.2.1

Try to reinstall it to, for example, C:\maven, or change your current variable M2_HOME to C:\PROGRA~1\apache-maven-3.2.1

Upvotes: 3

user3720852
user3720852

Reputation: 13

this is the settings for my maven.

name: MVN_HOME value: C:\Program Files\apache-maven-3.2.1

name: path -> add the following value(just the maven part) value: %JAVA_HOME%\bin;%MVN_HOME%\bin; -> this should have no spaces

Upvotes: 0

Related Questions