设置Maven 3.0.4,win7的路径 [英] Setting up the path for Maven 3.0.4, win7
问题描述
我一直试图在我的计算机win 7上第一次安装Maven v 3.0.4.设置路径环境时遇到问题系统变量我有以下4个条目:
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
当我做mvn --version
我得到了错误:
JAVA_HOME not found in your environment, please set the JAVA_HOME variable in your environment to match the location of your java installation
java -version可以正常显示Java版本,
The java -version displays the java version fine,
我到底在做什么错呢?路径没问题吗?
what am I doing so horribly wrong? Is the PATH ok?
感谢您的帮助,谢谢.
推荐答案
仅需要正确设置Maven二进制文件和JDK的路径:
It is only necessary to set the path to the Maven binary and to the JDK correctly:
set PATH %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\Java\jdk1.7.0_04\bin;C:\Program Files\apache-maven-3.0.4\bin
此外,您需要正确设置JAVA_HOME,这是在像这样的窗口下完成的:
Furthermore you need to set the JAVA_HOME correctly which is done under windows like this:
SET JAVA_HOME=C:\Program Files\Java\jdk1.7.0_04
请注意将JAVA_HOME设置为已安装JDK的根目录,而不是将其bin文件夹. 不需要设置M2和M2_HOME.
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.
这篇关于设置Maven 3.0.4,win7的路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!