I can't run my java servelet on my tomcat 9.0.12 server because it can't handle the class version. I get following error:
Error: MyClass been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0 (unable to load class
I compiled my code with java 11:
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
when I type in : java -version in my terminal I get:
java version "11.0.2" 2019-01-15 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.2+9-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.2+9-LTS, mixed mode)
and for javac -version
javac 11.0.2
Why can't the Runtime handle v55.0? java 11 == v55.0?!
Check the version of Java it is showing in the error
install/download that jdk in program files/java folder
in eclipse or STS right click on project -> builPath -> libraries -> add JRE system libraries -> add the version of jdk showing in the error as an alternate JRE

The problem is not tomcat but the JVM which runs tomcat.
I don't know how you start tomcat, but you should start it with a JDK 11.
If you use eclipse you should check the Server Runtime.
For other IDEs or starting it from OS directly (as an application or a service or whatever), you should check the JAVA_HOME and the PATH.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With