Maven error: Could not find or load main class org.codehaus.plexus.classworlds.launcher.Launcher

java, maven, windows

Solution

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.

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

Problem

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 ``` Environment Variables are: ``` M2_HOME C:\apache-maven-3.0.4\apache-maven\src JAVA_HOME C:\Program Files\Java\jdk-1.7.0_04 ``` Path variables added are: ``` %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 ``` 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 I'm still not able to get to it. What I might be missing in this whole thing?

Original source

Related problems