Robert Peake
Robert Peake

Reputation: 13

Apache Maven: Windows 7 64-bit classpath not recognized

Windows 7 does not recognize mvn as a command.

Environment variables:

M2_HOME:  D:\apache-maven-3.0.4
M2:  %M2_HOME%\bin
PATH: . . . :M2_HOME;M2; . . .

At a command prompt, entering "echo %M2_HOME%" and "echo %M2%" gives:

D:\apache-maven-3.0.4  and  D:\apache-maven-3.0.4\bin

Entering "%M2%\mvn --version" gives:

Apache Maven 3.0.4 (r1232337; 2012-01-17 03:44:56-0500)
Maven Home: D:\apache-maven-3.0.4
Java Version: 1.7.0_03, vendor: Oracle Corporation
Java Home: D:\Glassfish3\jdk7\jre
and so on.

Simply entering mvn --version" yields:

mvn is not recognized as an internal or external command,
operable program or file.

I have restarted Windows 7 to no avail. I am at a loss as to what is going on here. Any suggestions?

Upvotes: 1

Views: 2617

Answers (2)

Attila
Attila

Reputation: 28762

You need to set you PATH to refer to %M2% instead of just M2, otherwise the OS is looking for mvn in the folder M2, not the path denoted by the value of the M2 env. variable

Upvotes: 3

mfirry
mfirry

Reputation: 3692

You have to add %M2% to your Path variable

Upvotes: 4

Related Questions