1

I don't know what problem with my JasperReports report, when I try to add new datasource in iReport, I got this error

Unsupported major.minor version 51.0 
(unable to load class com.foundation.service.datasource.JsDataSourceService). 

I followed all the answer on StackOverflow, and I changed the complicance level to 1.7, jre also is set to jre7 too, I already check the environment variable

JAVA_HOME: C:\Program Files\Java\jdk1.7.0_25, 

but still got this error. Please help me to fix that!

Alex K
  • 22,315
  • 19
  • 108
  • 236
user1404916
  • 11
  • 1
  • 3
  • 1
    Are you talking about *iReport* or about the *Java* code? – Alex K Jun 24 '13 at 07:55
  • Yes, I'm talking about iReport – user1404916 Jun 25 '13 at 10:21
  • The *iReport* is a *NetBeans* (if you are not using the old "Classical" version). You should check the *JDK* version of your *IDE*. You can find more info reading [Unsupported major.minor version 51.0](http://stackoverflow.com/q/10382929/876298) post – Alex K Jun 25 '13 at 11:11

2 Answers2

0

This happened to me also - I had recently installed JDK 7, which is what that incompatible class version is. The root cause for me was that I was compiling my jasper reports using the maven plugin, which does not have a way to set -target 1.6. So, my solution was to run maven from a shell in which I'd made the following change:

export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home

do mvn --version to confirm you now get a 1.6 Javac instead of the 1.7. That's a more brute force way of setting the target class format.

I'm on OS X 10.8 - if you aren't, you may have to change that slightly, but hopefully the idea helps.

Jim P
  • 569
  • 3
  • 15
0

Your environment variable is already correct/set to jdk1.7.0_25. I bet the issue is with your IDE.

If you're using Eclipse, go to Configure Build Path

  1. Edit existing JRE System Library (previously set to jdk1.6)
  2. Choose Alternate JRE
  3. Browse to Installed JREs... (normally in C:/Program Files/Java..)
  4. Click Finish

enter image description here

Aza Suhaza
  • 220
  • 1
  • 2
  • 15