Recently the project updated the JDK, updated from the previous 1.7 to 1.8. After downloading and installing the new JDK, when compiling and starting Tomcat, an error was reported, and the prompt is: "Unsupported major.minor version xxx". The specific solution process will not be explained in detail here. Let’s share with you the solution.
First of all, this error occurs because the compiled JDK version is inconsistent with the JDK version used at runtime. So the solution is to unify the JDK version. The details are as follows:
1. Set the version of Maven compiled, maven-compiler-plugin jdk version
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.1</version> <configuration> <source>1.8</source> <target>1.8</target> <encoding>UTF-8</encoding> <compilerVersion>1.8</compilerVersion> </configuration> </plugin>
2. Eclipse global Compiler compliance level
3. Compiler compliance level of the project
4. JDK used by Tomcat
Strictly speaking, just setting the first and fourth JDKs should solve the problem, but in order to avoid reappearance in the future, the second and third steps need to be set as well.
Finally, attach the numeric code corresponding to the jDK version:
JDK 8 = 52,
JDK 7 = 51,
JDK 6.0 = 50,
JDK 5.0 = 49,
JDK 1.4 = 48,
JDK 1.3 = 47,
JDK 1.2 = 46,
JDK 1.1 = 45
The above is all the content of this article. I hope it will be helpful to everyone's learning and I hope everyone will support Wulin.com more.