Unsupported major.minor version 51.0 error after moving from IntelliJ IDEA JBoss to MyEclipse Tomcat

徘徊边缘 提交于 2020-01-11 06:21:26

问题


I am getting a Unsupported major.minor version 51.0 error after moving from IntelliJ IDEA JBoss to MyEclipse Tomcat.

Everything was working great under IntelliJ IDEA and JBoss and now we are moving to MyEclipse and Tomcat 6..

I am getting:

Unsupported major.minor version 51.0
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141

can someone please tell me how to fix this issue


回答1:


This happens when you compile the code in a higher version of the JDK than you are using at runtime.

You can set the compiler version here:

Project -> Properties -> Java Compiler



回答2:


It seems that the version of JRE under tomcat is newer than the one used to compile the code.

To fix the actual problem you should try to either update your JRE pointing in Tomcat with newer version Java JRE or specify target parameter to the Java compiler to instruct the compiler to create code compatible with earlier Java versions in Eclipse.



来源:https://stackoverflow.com/questions/17838495/unsupported-major-minor-version-51-0-error-after-moving-from-intellij-idea-jboss

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