My JSP project was running fine on Eclipse. However, I got the following error when I tried to add some value to database through my project data insert form.
org.apache.jasper.JasperException: javax.servlet.ServletException: java.lang.UnsupportedClassVersionError: com/mysql/jdbc/Driver : Unsupported major.minor version 51.0
After googling about the error, I found out that there was mismatch in the JVM version that is used to compile the class and the one used to run the class file.
In my case, the compiler compliance level for the Java compiler was set as openjdk 1.6. I changed it to 1.7 and the error was solved.
Here is the solution:
I am using Ubuntu Linux. The menu settings of Eclipse might be a bit different in Windows environment.
– Go to Window -> Preferences
– Go to Java -> Compiler -> Compiler compliance level = 1.7
– You might need to configure JRE definition. In Ubuntu:
– JRE home: /usr/lib/jvm/java-7-openjdk-i386 (for java 7 openjdk; 64 bit Ubuntu version might have different name)
– JRE name: java-7-openjdk-i386
The ‘Unsupported class version’ error was solved after adjusting the above settings.
Hope it helps. Thanks.