1

Possible Duplicate:
Exception in thread “main” java.lang.UnsupportedClassVersionError: a (Unsupported major.minor version 51.0)

Iam getting the error "Unsupported major.minor version 51.0". I am using jdk 1.6 and made the compiler compliance level to 1.6 and the jre is jre6. still I am geting the same error.

This is my error

java.lang.UnsupportedClassVersionError: transfer_1355215622877_662113 : 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 net.sf.jasperreports.engine.util.JRClassLoader.loadClass(JRClassLoader.java:245)
    at net.sf.jasperreports.engine.util.JRClassLoader.loadClassFromBytes(JRClassLoader.java:154)
    at net.sf.jasperreports.engine.design.JRAbstractJavaCompiler.loadEvaluator(JRAbstractJavaCompiler.java:76)
    at net.sf.jasperreports.engine.design.JRAbstractCompiler.loadEvaluator(JRAbstractCompiler.java:327)
    at net.sf.jasperreports.engine.design.JRDefaultCompiler.loadEvaluator(JRDefaultCompiler.java:218)
    at net.sf.jasperreports.engine.fill.JRFillDataset.createCalculator(JRFillDataset.java:404)
    at net.sf.jasperreports.engine.fill.JRBaseFiller.(JRBaseFiller.java:373)
Community
  • 1
  • 1
justified
  • 95
  • 1
  • 3
  • 12
  • 2
    Version 51 means that you've compiled that class with JDK 7, so you're not using JDK 6 like you think you are. – Jesper Jan 07 '13 at 15:30

1 Answers1

5

You're unintentionally using classes compiled with JDK 7 for JRE 7, with JRE 6.

You appear to have a report named transfer_1355215622877_662113 that was compiled with JDK 7 that needs to be recompiled with JDK 6.

Christoffer Hammarström
  • 27,242
  • 4
  • 49
  • 58
  • actually I had installed jdk 7 and removed and then installed jdk 6.but the problem still continues – justified Jan 07 '13 at 15:32
  • 1
    @justified: You need to recompile the classes you compiled with JDK 7, with JDK 6 instead, or run it all in JRE 7. – Christoffer Hammarström Jan 07 '13 at 15:33
  • 1
    @justified: From the stacktrace it looks like JasperReports is doing the compiling itself? I'm not sure. Possibly you need another version of JasperReports or some setting? Possibly JasperReports is caching old compiled reports, and the reports need to be recompiled with JDK 6? – Christoffer Hammarström Jan 07 '13 at 15:35
  • yes, me too think that the problem is with the JasperReports. Every other classes are working fine except this JasperReports – justified Jan 07 '13 at 15:42
  • You appear to have a report named `transfer_1355215622877_662113` that was compiled with JDK 7 that needs to be recompiled with JDK 6. – Christoffer Hammarström Jan 07 '13 at 15:43
  • 3
    Maybe the original poster is using jasperreports-maven-plugin which, contrary to common sense, uses the default java machine instead of the maven compiler plugin's target version. See http://pedroassuncao.com/blog/2012/04/16/jasperreports---unsupported-majorminor-version-510/ – mmalmeida Jun 19 '13 at 18:10