Unsupported major.minor version 51.0

↘锁芯ラ 提交于 2021-01-28 02:04:12

问题


I'm developing with CodenameOne in the IntelliJ IDE. When I choose "Send MacOS Desktop Build", I get this error message:

Unsupported major.minor version 51.0

My project SDK says 1.5 (Java Version 1.6.0_65) My Language level is set to 5.0

I've done a rebuild, which should recompile everything, but I still get this error. Version 51 refers to Java 7. Can anyone tell me how to fix this?


回答1:


This is a problem because we require a minimum of JDK 1.7 and now recommend JDK 8. You need to set IntelliJ to use that JDK and configure it to use it.




回答2:


Does your project have any 3rd party cn1libs? It is possible some of them have been compiled with Java 7.

A workaround in that case would be to change your project to use Java 8. (I think that is supported in IntelliJ, but not 100% sure). For changing the project to Java 8 there are a few settings you need to change. It is usually just easier to start a new project and check "Java 8" in the wizard. Then copy your sources over.




回答3:


Please find the list of major minor version related issue.

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

We can change the required compatible JDK Version from Configuration Page and it should work out.




回答4:


I had this issue while running cxf soap client.

Server: apache-tomcat-7.0.33

Error: java.lang.UnsupportedClassVersionError: org/apache/cxf/jaxws/JaxWsProxyFactoryBean : Unsupported major.minor version 51.0

Resolution: Resolved this by compiling the app using jdk1.8.0_65. Earlier i was using jdk1.7.



来源:https://stackoverflow.com/questions/34052428/unsupported-major-minor-version-51-0

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!