title: Error trying to install Maven on OSX Lion
body: <p>[UPDATE] Was just an idiot mistake. See end for solution.</p>
  
  <p>I am trying to install Maven on my 2011 Macbook Pro. Unfortunately I don't know Java at all, but I am trying to muddle my way through some tools built in Java, and they imply that using Maven to install them will make things easier.</p>
  
  <p>I followed the Maven install instructions here: <a href="http://maven.apache.org/download.html#Installation" rel="nofollow">http://maven.apache.org/download.html#Installation</a>. </p>
  
  <p>I...</p>
  
  <p>1) downloaded Maven,
  2) unzipped it, 
  3) put it in <code>/usr/local/apache-maven-3.0.3/</code>
  4) added </p>
  
  <pre><code>export M2_HOME=/usr/local/apache-maven/apache-maven-3.0.3`
  export M2=$M2_HOME/bin`
  export PATH=$M2:$PATH`
  </code></pre>
  
  <p>to my <code>.zshrc</code> file</p>
  
  <p>5) typed <code>mvn --version</code> and got back:</p>
  
  <pre><code>Exception in thread "main" java.lang.NoClassDefFoundError: org/codehaus/plexus/classworlds/launcher/Launcher
  Caused by: java.lang.ClassNotFoundException: org.codehaus.plexus.classworlds.launcher.Launcher
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
  </code></pre>
  
  <p>I found a couple of blog posts (http://steveswinsburg.wordpress.com/2011/03/09/java-update-broke-my-maven/) that described how to fix a similar sounding error, but those seem to be problems with upgrading Maven 2 to Maven 3. Afaik, I've never even had Maven 2. I nevertheless followed the directions in that post, and am still getting the exact same error.</p>
  
  <p>Please help!</p>
  
  <p>Also does anyone know a good resource for a beginner to learn how the "Java ecosystem", i.e. Maven, classpaths, etc works? I tried some "Learn Java" videos at udemy.com, but they were all about the syntax of programming in Java, whereas most of the problems I've been having have been around figuring out how to make existing Java apps run in the first place, or how to follow basic jargon-filled documentation.</p>
  
  <p>[SOLUTION] </p>
  
  <p>Summary...idiot mistake. </p>
  
  <p>While following the Maven installation directions, I cut-n-pasted the line "In a command terminal, add the M2_HOME environment variable, e.g. export M2_HOME=/usr/local/apache-maven/apache-maven-3.0.3", not realizing that I had actually installed my unzipped file in <code>/usr/local/apache-maven-3.0.3</code>.</p>
  
  <p>Once again, scumbag brain "saves time" by refusing to automatically read apparently redundant information, so I didn't notice that apache's example expected I had nested the install inside a second folder. </p>
  
  <p>Fixing the .zshrc line to read `export M2_HOME=/usr/local/apache-maven-3.0.3' fixed the problem.</p>
  
  <p>Thanks ivantod for pointing out my error. </p>