Yet another time to look into the resolution of another uncommon type of error encountered in the java world, the ‘unsupported major.minor version’ error. This error majorly occurs during run-time when the java version that was used to compile a java code into a class is different from the java version being used at run-time.
The solution as has been described in this post is to check for the version of the java being used at run-time and make use of the same java version when recompiling your java code (i used the netbeans IDE). Lets take an example of the error message in this way:
unsupported major.minor version 51.0
This message is simply saying the the java version needed is 1.5 and this is contrary to the version found in your application.
How do we resolve the error using the netbeans IDE.
1. Make sure the project is selected in netbeans and then press the ‘F11’ key, it should give you a box as shown below.
2. Click on Project Properties in the above box, it should give you the box below
3. Change the Source/Binary format (right at the lower part) to the one required and click the ‘ok’ button to save your changes, here I have changed it to version 1.5 as specified in the error. The warning message below should be ignored:
warning: [options] bootstrap class path not set in conjunction with -source 1.6
4.You can then recompile and go run your application again.