I have been trying to install Maven v 3.0.4 on my machine win 7 for the first time.I have a problem setting the path environment System variable I have the following 4 entries :
PATH
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\Java\jdk1.7.0_04;C:\Program Files\apache-maven-3.0.4\bin;M2_HOME;%M2%
M2_HOME
C:\Program Files\apache-maven-3.0.4\bin
M2
%M2_HOME%\bin
JAVA_HOME
C:\Program Files\Java\jdk1.7.0_04\bin
when I do mvn --version
I get the error:
JAVA_HOME not found in your environment, please set the JAVA_HOME variable in your environment to match the location of your java installation
The java -version displays the java version fine,
what am I doing so horribly wrong? Is the PATH ok?
Help appreciated, thanks.
It is only necessary to set the path to the Maven binary and to the JDK correctly:
Furthermore you need to set the JAVA_HOME correctly which is done under windows like this:
Be aware of setting JAVA_HOME to the root of the installed JDK and not to bin folder it. The settings of M2 and M2_HOME is not necessary.
Yes, Appending that path
C:\programfiles\maven\bin
to path variable in system variables is enough, it will work. No need to add user variables.from command prompt run the following
Version that I always use. Double click and you get the maven up and running
I followed all the steps but it was not working for me. But as soon i have set the
JAVA_HOME
Path, in Command prompt just type:It is working fine in fraction of seconds. Thanks Everyone.
If, like me, you are running
mvn -version
from the command prompt, and then adding any missing environment variables from the GUI, it is possible that you just have to reload the command prompt after adding the environment variables.Just exit and run cmd.exe