[英]Java environmental variable woes, maven also
So I re-installed java in a directory that doesn't have any spaces in it, as I was having issues with it before. 因此,我将Java重新安装在其中没有任何空格的目录中,因为我以前遇到过问题。
Java JDK is installed in: Java JDK安装在:
E:\downloads\java\jdk
I created a User variable: 我创建了一个用户变量:
JAVA_HOME E:\downloads\java\jdk
And my Path looks like: 我的路径看起来像:
%JAVA_HOME%\bin;%M2%;
Now opening a NEW cmd prompt: 现在打开一个新的 cmd提示符:
c:\java
'java' is not recognized...
but echoing works: 但回声有效:
c:\echo %JAVA_HOME%
E:\downloads\java\jdk
and so does this: 这样:
c:\%JAVA_HOME%\bin\java -version
java version "1.6.0_17"
I am trying to get this to work, so I can then get maven to work as maven is having the same type of issues (I created M2_HOME and M2 and none work). 我正在尝试使其工作,因此我可以使maven工作,因为maven存在相同类型的问题(我创建了M2_HOME和M2却无济于事)。
What exactly am I doing wrong? 我到底在做什么错? I am having the exact same issue on my laptop also, both are running windows 7. I must be missing something!
我的笔记本电脑上也出现了完全相同的问题,两个都运行Windows7。我一定缺少某些东西!
Edit As per your comments, the output of M2 is:
编辑根据您的评论,M2的输出为:
set M2 M2=E:\\downloads\\java\\apache-maven-2.2.1-bin\\apache-maven-2.2.1\\bin M2_HOME: e:\\downloads\\java\\apache-maven-2.2.1-bin\\apache-maven-2.2.1 设置M2 M2 = E:\\ downloads \\ java \\ apache-maven-2.2.1-bin \\ apache-maven-2.2.1 \\ bin M2_HOME:e:\\ downloads \\ java \\ apache-maven-2.2.1-bin \\ apache -maven-2.2.1
set PATH 设置路径
alt text http://img130.imageshack.us/img130/6996/javasetpath.png 替代文字http://img130.imageshack.us/img130/6996/javasetpath.png
As you can see on your capture, %JAVA_HOME%
and %M2%
are not expanded in your PATH
. 如您在捕获中所见,
%JAVA_HOME%
和%M2%
未在PATH
扩展。 I suspect that you mixed User variables and System variables . 我怀疑您混合了用户变量和系统变量 。 Declare PATH as a User variable like this:
将PATH声明为用户变量,如下所示:
%PATH%;%JAVA_HOME%\bin;%M2_HOME%\bin
Try to append a slash ('\\') at the end of the path, like this: 尝试在路径的末尾添加斜杠('\\'),如下所示:
%JAVA_HOME%\\bin\\;%M2%;
and let me know if it worked. 让我知道是否有效
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.