Bohn
Bohn

Reputation: 26919

Maven still doesn't run after setting environment variables

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?

Upvotes: 4

Views: 11837

Answers (3)

PabloQ
PabloQ

Reputation: 361

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"

Upvotes: 2

andrey
andrey

Reputation: 842

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.

Upvotes: 1

Andriy Plokhotnyuk
Andriy Plokhotnyuk

Reputation: 7989

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

Upvotes: 5

Related Questions