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

StackOverflow https://stackoverflow.com/questions/17838495

  •  04-06-2022
  •  | 
  •  

Вопрос

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

Это было полезно?

Решение

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

Другие советы

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.

If you did all kind of thing and it didn't work,

maybe you need to delete target in your project,

because I found if I builded them again and it would be very fast to compelete, then I relized I used old result of complier.

enter image description here

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top