title: set mac jdk version to 1.8
body: <p>I have searched several ways to change JDK version on mac.</p>
  
  <pre><code>$/usr/libexec/java_home
  </code></pre>
  
  <p>And I got</p>
  
  <pre><code>/Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home
  </code></pre>
  
  <p>I tried</p>
  
  <pre><code>$export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home
  </code></pre>
  
  <p>also tried</p>
  
  <pre><code>/usr/libexec/java_home 1.8.0_31 --exec javac -version
  </code></pre>
  
  <p>then I run</p>
  
  <pre><code>$echo $JAVA_HOME
  </code></pre>
  
  <p>/Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home</p>
  
  <p>then I re-check java -version</p>
  
  <pre><code>$java -version
  java version "1.7.0_67"
  Java(TM) SE Runtime Environment (build 1.7.0_67-b01)
  Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)
  </code></pre>
  
  <p>How I can really change java -version on my mac.</p>