user2666064
user2666064

Reputation: 1

Maven 3.0.5 installed in Windows 7 but not able to run through command prompt

As per suggestions given in this site i have added the required variables and values as below too but no response

JAVA_HOME=C:\Program Files\Java\jdk1.7.0_25

M2=%M2_HOME%\bin

M2_HOME=C:\Program Files\apache-maven-3.0.5-bin\apache-maven-3.0.5\bin

PATH=%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;%M2_Home%\bin

Please help me

Upvotes: 0

Views: 653

Answers (2)

Sergey Makarov
Sergey Makarov

Reputation: 2531

I had same situation multiple times, i.e. configured M2_HOME as user env variable and added it to PATH (system env variable), i.e.

PATH=%M2_HOME%\bin; ...

However sometimes (randomly) Windows don't resolve variable in path, run "echo %PATH%" in your console. In my case I can still see %M2_HOME% there instead of resolved path to maven installation directory. It seems to be a bug in Windows itself, which is present in WinXP and Win7 at least.

I have resolved it as follows:

  • Open env variables, change M2_HOME (user one) to correct value. Press OK to save and close window
  • Open env variables again, now open PATH (system one) variable details, make sure M2_HOME is there and press OK, i.e. just save without any modification.
  • Now, open command line and check "echo %PATH%" - there should be resolved path. Confirm by running "mvn --version".

I know it really sounds like a black magic, but it should work...

Upvotes: 0

Vijay Kukkala
Vijay Kukkala

Reputation: 362

Your path configuration has a M2_Home instead of M2_HOME. It should be all uppercase

%M2_HOME%

Also notice, you are specifying bin twice, should

M2_HOME=C:\Program Files\apache-maven-3.0.5-bin\apache-maven-3.0.5

Upvotes: 1

Related Questions