title: Exception in thread "main" java.lang.UnsupportedClassVersionError: a (Unsupported major.minor version 51.0)
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/10382929/unsupported-major-minor-version-51-0">unsupported major .minor version 51.0</a>  </p>
  </blockquote>
  
  
  
  <p>I installed JDK7, a simple hello word program gets compile but when I run this I got following exception.</p>
  
  <pre><code>Exception in thread "main" java.lang.UnsupportedClassVersionError: a (Unsupported major.minor version 51.0)
      at java.lang.ClassLoader.defineClass0(Native Method)
      at java.lang.ClassLoader.defineClass(Unknown Source)
      at java.security.SecureClassLoader.defineClass(Unknown Source)
      at java.net.URLClassLoader.defineClass(Unknown Source)
      at java.net.URLClassLoader.access$100(Unknown Source)
      at java.net.URLClassLoader$1.run(Unknown Source)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(Unknown Source)
      at java.lang.ClassLoader.loadClass(Unknown Source)
      at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
      at java.lang.ClassLoader.loadClass(Unknown Source)
      at java.lang.ClassLoader.loadClassInternal(Unknown Source)
  </code></pre>
  
  <p>I checked <code>java -version</code> on command prompt, it shows Java version 1.4.2_03 but when I tried to install new java version from java.com it says that I'm having recommended Java 7 version.</p>