title: Why I have the error Java is set to an invalid directory when i try to install Maven?
body: <p>I'm trying to install Maven in order to run selenium junit test 
  and then integrate it in Jenkins</p>
  
  <p>When I run in CMD : <code>mvn -version</code>, I have this:</p>
  
  <pre><code>Error: JAVA_HOME is set to an invalid directory.
  JAVA_HOME = "C:\Program Files\Java\jdk1.8.0_11\bin"
  Please set the JAVA_HOME variable in your environnement to match the 
  location of your Java installation.
  </code></pre>
  
  <p>When I run <code>java -version</code>, I have this:</p>
  
  <pre><code>java version "1.8.0_20"
  Java(TM) SE Runtime Environment (Build 1.8.0_20-h26)
  Java HotSPot(TM) 64-Bit Server VM (build 25.20-h23, mixed mode)
  </code></pre>
  
  <p>Why do I get this error?</p>
  
  <hr>
  
  <p>Here is my configuration for java and maven</p>
  
  <p>I have Windows 7 64bits</p>
  
  <ol>
  <li><p>I installed Maven here </p>
  
  <pre><code>C:\Program Files\Apache Software Foundation\apache-maven-3.2.3
  </code></pre></li>
  <li><p>For java, I have installed these version:</p>
  
  <pre><code>C:\Program Files\Java\jdk1.6.0_37  should i keep this version?
  C:\Program Files\Java\jdk1.7.0_60  should i keep this version?
  C:\Program Files\Java\jdk1.8.0_11  
  C:\Program Files\Java\jre1.8.0_20  
  C:\Program Files\Java\jre6
  C:\Program Files\Java\jre7
  </code></pre></li>
  <li><p>In User variable, I have this:</p>
  
  <pre><code>JAVA_HOME
  C:\Program Files\Java\jdk1.8.0_11\bin
  
  MAVEN_OPTS
  %M2% 
  
  PATH
  C:\Program Files\Java\jdk1.8.0_11\bin;
  </code></pre></li>
  <li><p>in System variable, I have this:</p>
  
  <pre><code>JAVA_HOME
  C:\Program Files\Java\jdk1.8.0_11\bin
  
  JRE_HOME
  C:\Program Files\Java\jre6;
  
  M2
  %MAVEN_HOME%\bin;
  
  MAVEN_HOME
  C:\Program Files\Apache Software Foundation\apache-maven-3.2.3;
  
  Path
  C:\Program Files\Apache Software Foundation\apache-maven-3.2.3\bin;C:\Program Files\Java\jdk1.8.0_11\bin;
  </code></pre></li>
  </ol>