How to fix java Unsupported major minor version 51 0 Exception

How to fix java Unsupported major minor version 51 0 Exception


How to fix java Unsupported major minor version 51 0 Exception

This video is from http://dev2qa.com, you can access the detailed tutorial by the following url.

http://www.dev2qa.com/how-to-fix-java


Content

0.64 -> Hello everybody, today i will show you how to fix
3.4 -> java.lang.UnsupportedClassVersionError Exception.
11.9 -> When you run a java program in Eclipse or command line.
14.99 -> You may encounter following exception.
21.85 -> java.lang.UnsupportedClassVersionError: Unsupported major.minor version 51.0.
32.46 -> This means your compiler java version is smaller than runtime java version.
36.559 -> In my environment, my runtime java version is 1.7, but i use java version 1.6 in my eclipse
53.26 -> as java compiler.
63.9 -> So i need to upgrade my eclipse java compiler version to 1.7 as following.
71.5 -> Click "Window ---> Preferences" in eclipse toolbar.
74.14 -> change window preferences Click "Java ---> Installed JREs" in left panel
81 -> of the popup window.
82 -> Click "Add" button in right panel.
83 -> change java installed jre in eclipse window preferences
84 -> Choose "Standard VM" in popup dialog, click "Next" button.
85 -> Click "Directory" button to choose the jdk home you installed.
90.56 -> (Not jre home, in my env, i choose: C:\Java\jdk1.7.0_25) select installed jdk home in eclipse window
104.1 -> preferences installed JREs Click "Finish" button.
107.89 -> click finish button to add new installed jdk Check the jdk you just installed.
116.25 -> Click "OK".
117.439 -> check just installed jdk in eclipse window preferences
122.2 -> Click "Project ---> Properties" in eclipse toolbar.
125.77 -> Click "Java Compiler" in left popup window.
128.93 -> Check "Enable project specific settings".
132.06 -> Select the jdk you just installed(1.7 in my environment).
135.8 -> change project java compiler version in eclipse Click "OK".
141.66 -> Now run your java program again, you will find the error disappeared.

Source: https://www.youtube.com/watch?v=nSZyHnU1_Gs