Jump to content
We've recently updated our Privacy Statement, available here ×

Compile reports with JasperCompileManager using a specific Java version


dusca

Recommended Posts

Hello,

 

I need to run a reporting application in a Java8 environment machine. Because of this, I need to compile my reports using Java8.

On my development machine, my eclipse project is set up to use Java8 as a JDK, and all project compliance params are set to Java8. However, the development machine also has installed and runs by default Java 11.

Even though my compiling application starts with Java8, the compiled results are compiled using Java11. I get an error:


java.lang.UnsupportedClassVersionError: <filename> has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0

I tried to run the application by adding in classpath a new user library pointing to eclipse jdt (eclipse/plugins/org.eclipse.jdt.core_3.27.0.v20210823-1758.jar) but that was no help, because that ended up in the same error but in a different place:


 java.lang.UnsupportedClassVersionError: org/eclipse/jdt/internal/compiler/Compiler has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0

I am compiling the jrxml files by calling:

            JasperCompileManager.compileReportToFile(getSourceAbsolutePath(), getDestinationAbsolutePath());

 

and I see no option to set the compile with version peroperty to this

 

Please note this is not a maven or gradle project, it is a simple Java application with a main() method, and I've set up the required libraries manually in the classpath.

 

Link to comment
Share on other sites

  • 1 year later...
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...