-2

java.lang.UnsupportedClassVersionError: Servlet/Demo : Unsupported major.minor version 52.0 (unable to load class Servlet.Demo) Apache Tomcat version is 7.0.69

2 Answers2

0

The Servlet/Demo class are compiled using JDK8. But Tomcat is not starting using JDK8 or JRE8.

If Tomcat is starting using JDK7 or JRE7 and you like to compile class using newer JDK. You have to specify the VM version for class file generated.

  1. For javac, add parameter -target 1.7
  2. For Eclipse, change the setting of Compiler compliance level to 1.7 in Java Compiler page.
Beck Yang
  • 3,004
  • 2
  • 21
  • 26
0

The main reason for this is that you must run and compile your application with the same version of Java.

Check what you are using in your IDE.

The Roy
  • 2,178
  • 1
  • 17
  • 33