[英]Setting Maven environment variable
I been trying to set the Maven environment variable, but it's not liking it. 我一直在尝试设置Maven环境变量,但它并不喜欢它。 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: 我知道我的Java版本应该正确,当我执行以下操作时:
javac -version
in cmd I do get the right version. 在cmd中,我确实获得了正确的版本。
Try using M2_HOME
instead of MAVEN_HOME
in the path and environment variable 尝试在路径和环境变量中使用M2_HOME
而不是MAVEN_HOME
M2_HOME ----> C:\\Program Files\\Maven\\apache-maven-3.0.5
and %M2_HOME%\\bin
in path M2_HOME ----> C:\\Program Files\\Maven\\apache-maven-3.0.5
和%M2_HOME%\\bin
在路径中
As you are using a jdk/maven path with space in between so try using the path in quotes such as : "C:\\Program Files\\Java\\jdk1.6.0_26" 当您使用jdk / maven路径之间有空格时,请尝试使用带引号的路径,例如:“ C:\\ Program Files \\ Java \\ jdk1.6.0_26”
Or 要么
simply dump the java and maven in non-space directories as it avoids such problems. 只需将Java和Maven转储到非空间目录中,即可避免此类问题。 I generally put java in C:\\Java\\jdk1.6.0_26 and mavin in C:\\maven\\maven3.0. 我通常将Java放在C:\\ Java \\ jdk1.6.0_26中,将mavin放在C:\\ maven \\ maven3.0中。
Try either of the solutions and you should get lucky :-) 尝试任何一种解决方案,您都应该会很幸运:-)
And please ensure to put the JAVA_HOME environment variable inside the system environment variables and not the user environment variables. 并且请确保将JAVA_HOME环境变量放在系统环境变量而不是用户环境变量中。 Don't forget to restart your shell after you changed environment variables. 更改环境变量后,请不要忘记重新启动Shell。
如果使用eclipse,则将JRE中的VM参数设置为
-Dmaven.multiModuleProjectDirectory=true
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.