Monday, June 29, 2015

Java Class Versions

Last week, I was trying to compile an old code written for JBoss 4.3.2. When I was deploying I got this error message:

Unsupported major.minor version 51.0

But for reference here is the list of class file version with java version:

Java SE 8 = 52
Java SE 7 = 51
Java SE 6 = 50
J2SE 5.0 = 49
J2SE 1.4 = 48
J2SE 1.3 = 47
J2SE 1.2 = 46
JDK 1.1 = 45

The complete error message:

  Bean   : MyClassEJB
  Section: 22.2
  Warning: The Bean Provider must specify the fully-qualified name of the Java class that implements the enterprise bean's business methods in the  element.
  Info   : Class not found on 'com.mypackage.ejb.MyClassEJB': Unexpected error during load of: com.mypackage.ejb.MyClassEJB, msg=com//mypackage/ejb/MyClassEJB : Unsupported major.minor version 51.0

The problem was that my Eclipse was running with Java SE 7. And because it was a old project (no maven, nothing modern), all class files were stored in a "bin" directory with version 51.0 (Java SE 7).

Later with an ant script, running with Java SE 6, all files were packaged. But the class obviously were in Java SE 7. That was my issue at deploying time.

1 comment: