title: java.lang.UnsupportedClassVersionError: Bad version number in .class file
body: <p>I'm having this error in eclipes <code>java.lang.UnsupportedClassVersionError: Bad version number in .class file</code>.</p>
  
  <p>When I run <code>javac -version</code> it prints </p>
  
  <pre><code>javac 1.5.0_28
  </code></pre>
  
  <p>Within eclipes if I right click, properties->java compiler it says I'm using <code>1.5</code> and if I then go to <code>java build path</code>, I have <code>JRE System Library [JVM 1.5.0 (MacOS X Default)]</code> in there.</p>
  
  <p>Why am i getting this error and how do I fix it?</p>
  
  <p><strong>EDITS</strong></p>
  
  <p><code>java -version</code> prints</p>
  
  <pre><code>java version "1.5.0_28"
  Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_28-b04-382-9M3326)
  Java HotSpot(TM) Client VM (build 1.5.0_28-157, mixed mode, sharing)
  </code></pre>
  
  <p>The other libraries in my application is the libgdx library.</p>
  
  <p>The full error is </p>
  
  <pre><code>Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file
  at java.lang.ClassLoader.defineClass1(Native Method)
  at java.lang.ClassLoader.defineClass(ClassLoader.java:676)
  at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
  at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
  at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
  at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
  at java.security.AccessController.doPrivileged(Native Method)
  at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:317)
  at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:280)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
  at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:375)
  </code></pre>