Eclipse uses high jdk compiled version of the low-class version of the file method

If that, in the past two days using the eclipse tool compiled code, compiled class files take UE tool to view, version 1.8 version, while using a local version of tomcat 1.6, running error Unsupported major.minor version 52.0 

Java JDK version and internal version number of the compiler

J2SE 8 = 52,
J2SE 7 = 51,
J2SE 6.0 = 50,
J2SE 5.0 = 49,
JDK 1.4 = 48,
JDK 1.3 = 47,
JDK 1.2 = 46,
JDK 1.1 = 45

Look mistake knowingly jdk version is not correct, they can not break out of the version of the run, but unfortunately the Internet to find relevant documents,

Take UE tool to view the compiled file as shown below:

 

Position as shown is 32, 32 for the 1.6 version of the compiled file, and the number of my days have been compiled file shows 34, corresponding jdk is 1.8, JDK version online correspondence is given by:

version number The corresponding decimal JDK version number
2E 46 jdk1.2
2F 47 jdk1.3
30 48 jdk1.4
31 49 jdk1.5
32 50 jdk1.6
33 51 jdk1.7
34 52 jdk1.8

Learn the correspondence, the thought of you know, I compiled files 1.8 class will be given in the 1.6 environment, so think about whether you can use jdk1.8 eclipse compiler tool to compile the JDK1.6 version of the class file, found through the search right java project, "Properties" - "jAVA Compiler" in the following configurations:

 

 首先,将"use default compiliance settings"的复选框的勾选去掉,然后将"Generated .class files compatibility" 和 "Source compatibility"两个选项修改为1.6,重新编译后,class文件就被编译为1.6版本的class文件,运行中将不再报错.

 

Guess you like

Origin www.cnblogs.com/symbol8888/p/11933113.html