title: Application is using Java 6 from Apple instead of Java 7 from Oracle on Mac OS X?
body: <p>I am testing my current application with Mac OS X which has Java 7 from Oracle installed. Instead using Java 7 from Oracle, it's using Java 6 from Apple. The default system output of <code>java -version</code> is showing <code>7</code>. </p>
  
  <p>I tried most of the things mentioned in different sites, but I was unable to fix this issue. </p>
  
  <p><code>JAVA_HOME</code> is also properly set.</p>
  
  <p>I am using the Mac only for testing purposes. I really need some guidance on this.</p>
  
  <p>When I run it with Eclipse by selecting JRE 7, it runs properly. Thus there is nothing wrong with the application. I am missing something on Mac OS X.</p>
  
  <p>My Java system environment looks like this:</p>
  
  <ul>
  <li><p>OS X version</p>
  
  <p><code>10.8</code></p></li>
  <li><p><code>/usr/libexec/java_home -V</code></p>
  
  <pre><code>Matching Java Virtual Machines (3):
  1.7.0_12, x86_64: "Java SE 7" /Library/Java/JavaVirtualMachines/jdk1.7.0_12.jdk   
  1.6.0_37-b06-434, x86_64: "Java SE 6" /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
  1.6.0_37-b06-434, i386: "Java SE 6" /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
  
  /Library/Java/JavaVirtualMachines/jdk1.7.0_12.jdk/Contents/Home
  </code></pre></li>
  <li><p><code>/usr/libexec/java_home</code></p>
  
  <pre><code>/Library/Java/JavaVirtualMachines/jdk1.7.0_12.jdk/Contents/Home
  </code></pre></li>
  <li><p><code>echo $JAVA_HOME</code> </p>
  
  <pre><code>/Library/Java/JavaVirtualMachines/jdk1.7.0_12.jdk/Contents/Home/
  </code></pre></li>
  <li><p><code>JAVA_ARCH</code> is not set</p></li>
  <li><p><code>/Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java -version</code></p>
  
  <pre><code>java version "1.7.0_12-ea"
  </code></pre></li>
  <li><p><code>ls /Library/Java/JavaVirtualMachines</code></p>
  
  <pre><code>jdk1.7.0_12.jdk
  </code></pre></li>
  <li><p><code>/System/Library/Frameworks/JavaVM.framework/Commands/java -version</code></p>
  
  <pre><code>java version "1.6.0_37"
  </code></pre></li>
  </ul>
  
  <p>I guess my current JDK is pointing to something wrong.</p>