cmd cannot find mvn command

derfium picture derfium · May 7, 2017 · Viewed 23.8k times · Source

I just installed Maven and added the \bin directory of maven to my path variables. When I try to use the mvn command in the Command Prompt I just get a message:

mvn: command not found

Everything else I found on here did not help yet.

Edit:

I used https://maven.apache.org/install.html to install maven.

SET PATH=%PATH%;C:\Program Files\Maven\apache-maven-3.5.0\bin\mvn.cmd
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC

Answer

rene picture rene · May 7, 2017

You have included the file in the path:

C:\Program Files\Maven\apache-maven-3.5.0\bin\mvn.cmd

That is not good. The PATH environment variable should only include a path to where files, like exe and cmd's can be found.

Adapt your PATH to read like this:

C:\Program Files\Maven\apache-maven-3.5.0\bin

(so remove the \mvn.cmd). Make sure to start a new command prompt to verify if your path settings are correct.

See How can I set user environmental variables (such as PATH) from a non-administrator account on Windows 7 to find the correct Windows dialog to adapt the settings among many more.