title: Error: Could not find or load main class org.codehaus.classworlds.Launcher while building Maven 3.0.4
body: <p>I have used <code>apt-get install maven2</code> to install <em>maven2.2.1</em>. In order to compile <em>hadoop 2.1.0</em> source program, I need to upgrade the <em>maven</em> version, but it is not able to use <code>apt-get</code> again, because <em>maven2.1.0</em> is the latest in the lib.</p>
  
  <p>I downloaded <code>apache-maven-3.0.5-bin.tar.gz</code> from the official website, ran <code>tar apache-maven-3.0.5-bin.tar.gz</code> at the path <code>/usr/local</code>, and put <code>apache-maven</code> links to <em>apache-maven-3.0.5</em>:</p>
  
  <pre><code>lrwxrwxrwx  1 root root   18 Dec  8 11:26 apache-maven -&gt; apache-maven-3.0.5
  drwxr-xr-x  6 root root 1024 Dec  8 11:12 apache-maven-3.0.5
  
  export the order in the terminal like this:
  export M2_HOME=/usr/local/apache-maven
  export PATH=$PATH:$M2_HOME/bin 
  </code></pre>
  
  <p>input order "export" to identify :</p>
  
  <pre><code>.............................................
  declare -x M2_HOME="/usr/local/apache-maven"
  declare -x MANDATORY_PATH="/usr/share/gconf/ubuntu.mandatory.path"
  declare -x OLDPWD="/usr"
  declare -x PATH="/usr/lib/lightdm/lightdm:/usr/local/java/latest/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/apache-maven/bin"
  </code></pre>
  
  <p>All signs showed <em>maven 3.0.5</em> has succeeded in configuration, but when I input</p>
  
  <p><code>mvn -version</code> </p>
  
  <p>in the terminal, it show errors like this:</p>
  
  <pre><code>Error: Could not find or load main class org.codehaus.classworlds.Launcher
  </code></pre>
  
  <p>If I change a new terminal and input <code>mvn -version</code>, it shows:</p>
  
  <pre><code>administrator@ubuntu:~$ mvn -version
  Apache Maven 2.2.1 (rdebian-8)
  Java version: 1.7.0_45
  Java home: /usr/local/java/jdk1.7.0_45/jre
  Default locale: en_US, platform encoding: UTF-8
  OS name: "linux" version: "3.5.0-17-generic" arch: "amd64" Family: "unix"
  </code></pre>
  
  <p>It happens every time although I had uninstalled <em>maven 2.2.1</em> by running:</p>
  
  <p><code>sudo apt-get remove --purge maven</code></p>
  
  <p>I do not know why? I have not uninstalled it completely?</p>