Maven 错误:无法找到或加载主类 org.codehaus.plexus.classworlds.launcher.Launcher [英] Maven error: Could not find or load main class org.codehaus.plexus.classworlds.launcher.Launcher
问题描述
我在 Windows 7 上安装了最新的 maven-3.0.4
:
安装细节如下:
安装路径:
I have installed a latest maven-3.0.4
on Windows 7:
The installation details are as follows:
Installation Path :
C:apache-maven-3.0.4
环境变量是:
M2_HOME C:apache-maven-3.0.4apache-mavensrc
JAVA_HOME C:Program FilesJavajdk-1.7.0_04
添加的路径变量是:
%M2_HOME%in;%JAVA_HOME%in;
在命令窗口中它显示如下:
In the command window it shows it like this:
C:>java -version
java version "1.7.0_04"
Java(TM) SE Runtime Environment (build 1.7.0_04-b22)
Java HotSpot(TM) Client VM (build 23.0-b21, mixed mode, sharing)
C:>mvn -version
Error: Could not find or load main class org.codehaus.plexus.classworlds.launcher.Launcher
这是我电脑上唯一安装的 maven 版本,很多博客上提到的删除之前的 M2_HOME
环境变量的解决方案是无效的.
This is the only version on maven installed on my PC and the solution given on many blogs referring to the deletion of the previous M2_HOME
environment variable is not valid.
我已阅读并尝试了博客中提供的所有解决方案,例如:
I have read and tried all the solutions given at blogs such as :
但仍然无法达到它.我在这整件事中可能缺少什么?提前致谢.
but still not able to get to it. What I might be missing in this whole thing? Thanks in advance.
推荐答案
我也遇到了这个问题,发现 这篇文章.对于 Maven3,将我的环境变量名称从 M2_HOME 更改为 M3_HOME 可以解决问题.我在运行 OSX 10.9 和 JDK 1.7 的 Mac 上.希望这会有所帮助.
I hit this problem too, and found this article. For Maven3, changing my environment variable name from M2_HOME to M3_HOME did the trick. I am on a Mac running OSX 10.9 with JDK 1.7. Hope this helps.
注意:如果已经设置,请删除 M2_HOME.例如:unset M2_HOME
Note: Please delete M2_HOME, if already set. Eg: unset M2_HOME
这篇关于Maven 错误:无法找到或加载主类 org.codehaus.plexus.classworlds.launcher.Launcher的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!