Today, a colleague ran into a problem , Also deepened their own right eclipse in buildpath and javacompilercompliancelevel Understanding of .  

         The problem is this , Colleagues in eclipse Projects developed in , Derivation jar after , Put it on the server , Always report “Unsupported major.minor version 51.0” Error of , Check it on the Internet , Always said it was JDK The problem of , But it's not clear what's going on , How to solve it , last , Passing another colleague , It's finally solved , And I finally understood the context of the problem : stay eclipse There are projects developed in java build path Can be configured in jdk, There's another one java compiler Can be configured in compiler level, There is a difference between the two ,build path Of JDK The version is you When developing, the compiler needs to use , It's you eclipse Development code in , I'll give you an indication that it's wrong , The process of compiling ;java compiler compliance level The build version number configured in , The purpose of this compiled version number is to , The future of your project After development , To run on the server , On that server JDK Running version of . The problem with colleagues is ,build path Medium configuration 1.7 Of JDK,java compiler compliance level Configured in 1.7, But on the server 1.6 Of JDK, That's the mistake , It's used for compiling jdk(1.7) Compared with that used in operation jdk(1.6) It's high , This is wrong . 

         summary :build path Of JDK Version is what the compiler needs to use when you develop it , for example , If you use it JDK1.4 You can't use generics . and java compiler compliance level It's set up by you JAVA What does the code follow JDK Version level compilation , for example : The settings are 1.4, It's compiled class Files can be found in 1.4 Above JRE Run on , If you use 5.0 Level compilation , Can't run in 1.4 In the environment of , The version is too high . 

         supplement : It is proved by examples , stay eclipse During the development process ,build path in JDK Compile the class library ( Is this where you use classes JDK in ),java compiler compliance level Is the compilation of the project syntax ( It's whether the grammar in your project is correct or not ), In the process of development , Both of them work . So , The safest way , yes build path and java complier compliance level And server configured JDK It's consistent , There won't be any problems .