4

here is what I have set in User Variables to run maven..

JAVA_HOME

C:\Program Files\Java\jdk1.7.0_05

M2

%M2_HOME%\bin

M2_HOME

C:\Program Files\apache-maven-3.0.4

MAVEN_OPTS

-Xms256m -Xmx512m

PATH

%PATH%;%JAVA_HOME%\bin;%M2_HOME%\bin;

but still a mvn --version command gives my error. I followed the steps in their own website and still getting the error. Do you see anything wrong with what I posted above?

3
  • 1
    This isn't a maven question, it's a simple matter of Windows path management. 'mvn' is just 'mvn.bat' from the bin dir. There's nothing maven-specific here. Are you sure that PATH is set as you think it is in the command-line windows you are using? Commented Jul 23, 2012 at 16:08
  • 1
    And if you navigate to %M2_HOME%\bin there is a mvn executable or batch file in that directory? Commented Jul 23, 2012 at 16:08
  • That's a great question. I have the same problem. It's totally weird. Commented May 14, 2019 at 7:08

3 Answers 3

5

Have you restarted your command line window after PATH set up?

Sign up to request clarification or add additional context in comments.

1 Comment

I did restarted command prompt, computer, brain. still no result.
2

I made it work by restarting the command line tool, for doing this you have to start your CMD as administrator. Right click on CMD icon and select "Run as administrator"

Comments

1

On your place I would try this:

open command prompt (Start - Run - type "cmd") and type:

cd %M2_HOME%\bin
dir

make sure you see something like "mvn.exe" or "mvn.bat"

If "cd %M2_HOME%\bin" doesn't work, the something wrong with environment. (Ex: you logged in with different user). Try

echo %M2_HOME%

in command prompt.

PS: The better way to check environment is to type "set" in command prompt.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.