Solve error in Jasper Report: Unsupported major.minor version 51.0

0

I have created a scriptlets in java, at the moment of executing the preview of the report and invoking the scriptlets function it marks me the following error:

  

Error filling print ... java.lang.UnsupportedClassVersionError: numberletras / NumeroletrasScriptlet: Unsupported major.minor version 51.0 null   java.lang.UnsupportedClassVersionError: numberletras / NumeroletrasScriptlet: Unsupported major.minor version 51.0

The version I use of Jasper Report is 4.6 and the java version installed is 1.7

    
asked by Ken 06.07.2016 в 18:04
source

1 answer

1

The error you have is not associated with Jasper, but with the version of Java that you use. Apparently the jar (either Jasper or another library or perhaps your own code) was compiled using Java 7 and the code is running from a JVM 6 or lower. I recommend you check the following table of versions:

Java SE 9 = 53,
Java SE 8 = 52,
Java SE 7 = 51,
Java SE 6.0 = 50,
Java SE 5.0 = 49,
JDK 1.4 = 48,
JDK 1.3 = 47,
JDK 1.2 = 46,
JDK 1.1 = 45

(Source: link ).

You can identify the file (or files) guilty (s) when opening the compiled, the .class, and see in the hexadecimal at the beginning of the file the following:

CA FE BA BE 51

Solution: Use a JVM 7 or higher to run your project. To make sure you really use Java 7 when executing your project, open a command line (cmd, shell, etc) and execute the following

java -version

It should appear that you use version 7. Otherwise, you may not use Java 7 in your project.

    
answered by 06.07.2016 / 18:32
source