title: Java 1.7 on OSX 10.9.2 running as 1.5?
body: <p>Pulling my hair out about this one. <code>java -version</code> and <code>javac -version</code> both report the same 1.7.0_45, but when I try to compile the simplest class I get a class file error:</p>
  
  <pre><code>&gt; cat A.java
  public class A {}
  
  &gt; javac A.java
  A.java:1: cannot access java.lang.Object
  bad class file: /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/jre/lib/rt.jar(java/lang/Object.class)
  class file has wrong version 51.0, should be 49.0
  Please remove or make sure it appears in the correct subdirectory of the classpath.
  public class A {}
         ^
  1 error
  </code></pre>
  
  <p>There certainly is no JDK 1.5 installed. I don't think there even <em>is</em> a 1.5 JDK that runs on OSX any more.</p>
  
  <p>FWIW, here's the frameworks directory containing the "versions" and stub executables:</p>
  
  <pre><code>&gt; ls -al /System/Library/Frameworks/JavaVM.framework/Versions/
  total 64
  drwxr-xr-x  11 root  wheel  374 28 Mar 09:03 .
  drwxr-xr-x  12 root  wheel  408 11 Mar 07:52 ..
  lrwxr-xr-x   1 root  wheel   10 29 Oct 12:54 1.4 -&gt; CurrentJDK
  lrwxr-xr-x   1 root  wheel   10 29 Oct 12:54 1.4.2 -&gt; CurrentJDK
  lrwxr-xr-x   1 root  wheel   10 29 Oct 12:54 1.5 -&gt; CurrentJDK
  lrwxr-xr-x   1 root  wheel   10 29 Oct 12:54 1.5.0 -&gt; CurrentJDK
  lrwxr-xr-x   1 root  wheel   10 29 Oct 12:54 1.6 -&gt; CurrentJDK
  lrwxr-xr-x   1 root  wheel   10 29 Oct 12:54 1.6.0 -&gt; CurrentJDK
  drwxr-xr-x   8 root  wheel  272 28 Mar 09:03 A
  lrwxr-xr-x   1 root  wheel    1 29 Oct 12:54 Current -&gt; A
  lrwxr-xr-x   1 root  wheel    1 28 Mar 09:03 CurrentJDK -&gt; A
  </code></pre>
  
  <p>I've checked the usual suspects, there's no JAVA_HOME or CLASSPATH environment variables, not that it matters when there's no 1.5 installed. I also get the exact same behaviour if I install JDK 8.</p>
  
  <p>Does anybody have an idea what's causing this? </p>