0

Basically what I want to do is create a PDF from a iReport jrxml or jasper file.

The idea is to use this for reports over the net and the best solution I managed to find was to use a program like jasperstarter and then run the report with a connection to MSSQL database.

To get the connection going I had to download the latest net.sourceforge.jtds.jdbc.Driver.

The report works fine using iReport 5.1 but when I do follow the instructions from jasperstarter I get an "java.lang.UnsupportedClassVersionError" response.

jasperstarter command

jasperstarter pr -t generic -f pdf -i test_report.jasper -o test -u username -p       password --db-driver net.sourceforge.jtds.jdbc.Driver --db-url jdbc:jtds:sqlserver://LOCAL-PC/Demo_DB

output

Exception in thread "main" java.lang.UnsupportedClassVersionError: net/sourcefor
ge/jtds/jdbc/Driver : Unsupported major.minor version 51.0
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClassCond(Unknown Source)
        at java.lang.ClassLoader.defineClass(Unknown Source)
        at java.security.SecureClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.access$000(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Unknown Source)
        at de.cenote.jasperstarter.Db.getConnection(Db.java:69)
        at de.cenote.jasperstarter.Report.fill(Report.java:220)
        at de.cenote.jasperstarter.App.processReport(App.java:222)
        at de.cenote.jasperstarter.App.main(App.java:107)

Please advice.

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
RiaanSA
  • 11
  • 1
  • 2
  • possible duplicate of [unsupported major.minor version 51.0](http://stackoverflow.com/questions/10382929/unsupported-major-minor-version-51-0) – Stephen C May 10 '13 at 09:52

2 Answers2

1

Basically, you are trying to run code that was compiled on / for Java 7 on an older JVM.

That doesn't work.

Either:

  • run your application on a Java 7 JVM (or later1); i.e. upgrade your Java version,
  • find a build of the JDTS driver that is suitable for your execution platform, or
  • find the source for the JDTS driver and build it for your platform.

For more detailed information on this exception and its causes, read:


1 - Note that even Java 7 is end-of-life now. If you are still running that version of Java you should upgrade.

Stephen C
  • 698,415
  • 94
  • 811
  • 1,216
  • Thanks for the advice. I had to un-install everything and redo it by using the latest versions. That solved my problem. – RiaanSA May 13 '13 at 11:31
0

Make sure you have same JRE and JDK.

If not sure un-install download the latest JDK and try again.

Note that the JDK does install the JRE automatically.

RiaanSA
  • 11
  • 1
  • 2