Maven错误:无法找到或加载主类org.codehaus.plexus.classworlds.launcher.Launcher [英] Maven error: Could not find or load main class org.codehaus.plexus.classworlds.launcher.Launcher

查看:4651
本文介绍了Maven错误:无法找到或加载主类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.4\apache-maven\src  
JAVA_HOME C:\Program Files\Java\jdk-1.7.0_04  

添加的路径变量是:

%M2_HOME%\bin;%JAVA_HOME%\bin;

在命令窗口中它显示如下:

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上安装的唯一版本PC和许多博客上提到的解决方案是指删除之前的 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 :

  • oracle blog,
  • stackoverflow question,
  • another stack question,
  • some blog,

但仍无法达到目标。在这件事中我可能会缺少什么?提前致谢。

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就可以了。我在使用JDK 1.7运行OSX 10.9的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。例如:取消设置M2_HOME

Note: Please delete M2_HOME, if already set. Eg: unset M2_HOME

这篇关于Maven错误:无法找到或加载主类org.codehaus.plexus.classworlds.launcher.Launcher的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆