java.lang.UnsupportedClassVersionError: Unsupported major.minor version 51.0

Exception

java.lang.UnsupportedClassVersionError: Unsupported major.minor version 51.0

I am getting following Exception

java.lang.UnsupportedClassVersionError: com/kruders/manytomany/Main : Unsupported major.minor version 51.0
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(Unknown Source)
    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$000(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)
Exception in thread "main"

Solution
Right Click on Project -> Properties -> Java Compiler as shown in Figure 2.1 and Figure 2.2

Figure 2.1 Figure 2.1

Figure 2.2 Figure 2.2

Enable project specific settings and select Compiler compliance level to 1.6 as shown in Figure 2.3

Figure 2.3 Figure 2.3

No comments yet.

Leave a Reply