I came across this exception when trying to compile using Ant in my Eclipse environment. I set my eclipse default JRE to the highest version I had, I then set my compliance to the same version to ensure they matched. I followed the instructions from stackoverflow:
http://stackoverflow.com/questions/8982730/unsupportedclassversionerror-unsupported-major-minor-version-51-0-unable-to-load
That usually fixes the issue but in my case - it did not go away. Time to research. What I learned:
Major.minor => version on which the java class was compiled and can comply to.
This means that this exception occurs due to the compiler compiling at a higher version than the runtime Java. For me- since I'm executing an ANT target the fix became simple:
Right click your ant target in the ant view in eclipse - go to run configurations - select correct JRE.
It seems the ant targets were preset to the wrong JRE.
Hope that helps :)
http://stackoverflow.com/questions/8982730/unsupportedclassversionerror-unsupported-major-minor-version-51-0-unable-to-load
That usually fixes the issue but in my case - it did not go away. Time to research. What I learned:
Major.minor => version on which the java class was compiled and can comply to.
This means that this exception occurs due to the compiler compiling at a higher version than the runtime Java. For me- since I'm executing an ANT target the fix became simple:
Right click your ant target in the ant view in eclipse - go to run configurations - select correct JRE.
It seems the ant targets were preset to the wrong JRE.
Hope that helps :)