2

I been trying to set the Maven environment variable, but it's not liking it. I don't know why, I've triple checked everything and it should be working.

Here is the error I got:

ERROR: JAVA_HOME not found in your environment variable.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation

And here are my variables:

JAVA_HOME ---> C:\Program Files\Java\jdk1.6.0_26
MAVEN_HOME ----> C:\Program Files\Maven\apache-maven-3.0.5

Path ----> C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;%JAVA_HOME%\bin;%MAVEN_HOME%\bin

Sorry if my path file is a little long. Basically the important part is that I did indeed put them in right, they should both be at the very end. What else could have gone wrong?

Also to clarify a little bit, I did check that the file is indeed where I specify it to be. And I know my Java version should be right, when I do a:

javac -version

in cmd I do get the right version.

4

4 回答 4

4

尝试在路径和环境变量中使用M2_HOME而不是MAVEN_HOME

M2_HOME ----> C:\Program Files\Maven\apache-maven-3.0.5%M2_HOME%\bin在路径中

于 2013-05-01T03:08:45.397 回答
1

当您使用中间有空格的 jdk/maven 路径时,请尝试使用引号中的路径,例如:“C:\Program Files\Java\jdk1.6.0_26”

或者

只需将 java 和 maven 转储到非空间目录中即可避免此类问题。我一般把java放在C:\Java\jdk1.6.0_26,把mavin放在C:\maven\maven3.0。

尝试任何一种解决方案,你应该会很幸运:-)

于 2013-05-01T04:43:34.163 回答
1

请确保将 JAVA_HOME 环境变量放在系统环境变量中,而不是用户环境变量中。更改环境变量后不要忘记重新启动 shell。

于 2013-05-05T22:36:41.470 回答
0

如果您使用的是 eclipse,则将 JRE 中的 VM 参数设置为

-Dmaven.multiModuleProjectDirectory=true
于 2017-07-19T05:35:40.280 回答