iReport: Getting "Unsupported major.minor version 51.0" message when add the new datasource - jasper-reports

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!

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.

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
Edit existing JRE System Library (previously set to jdk1.6)
Choose Alternate JRE
Browse to Installed JREs... (normally in C:/Program Files/Java..)
Click Finish

Related

export with jdk 8 still got error when start server

I used eclipse with jdk 8 to export to jar. Yet i still get this error when start my server sfs
Exception in thread "main" java.lang.UnsupportedClassVersionError: sfs2x/extension/mmo/MMORoomDemoExtension$NPCData 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
Could someone tell me how to fix.
I tried to uninstalled all java and install jdk8 only. But nothing change.
I had a similar problem, what fixed it for me was making sure that jdk8 was selected as the build jdk for that project (right click on your project in Eclipse and click on properties -> Java build path -> JRE System Libraries -> Workspace Default JRE, make ure that jdk8 is selected) and then recompiling. I was able to delete all .class files before recompiling as well, but that may be difficult if this is a project.
Best of luck.

unsupported major.minor version in jasperstudio 5.6.x with scriptlet classes

I have created a simple .jar with a class to process a parameter in my Jasper report via scriptlets. I have added the .jar to the build path of the report project.
The .jar has been compiled with JDK 1.7, and the execution enviroment of the Jasper project is set to JRE 1.7, and also the Java Compiler compliance level is 1.7. JAVA_HOME points to jdk 1.7.
Still JasperStudio complains of Unsupported major.minor version 51.0 when trying to access the .jar throught the scriptlet parameter.
Is JasperStudio using jdk 1.6 ?! I think I have ensured it does not by setting all relevant Java properties for the project.
My computer does not even have java 1.6.
There is sth about JasperStudio evidently that still is overriding my jre/jdk choices, but I do not know where/how. Please send me your suggestions on where to look. Thanks a millio
This exception occurs when compiled class version (JDK) does not match with the executing class version (JDK). Jasperserver has a inbuilt JRE within it.
Please confirm the jasperserver JDK Version with the Installed JDK version (Oracle).
To fix the actual problem you should try to either run the Java code with a newer version of Java JRE or specify the target parameter to the Java compiler to instruct the compiler to create code compatible with earlier Java versions.
For example, in order to generate class files compatible with Java 1.4, use the following command line:
javac -target 1.4 HelloWorld.java
Here 1.4 refers to the JDK version of Jasper Server.

Cannot build resteasy from source

I got the code from github for resteasy. When trying to do an mvn clean install, I am getting the following exception. I would appreciate if someone can point me in the correct path on how to resolve this.
The error is:
/D:/rnd_work/jboss/resteasy/Resteasy/jaxrs/resteasy-client/src/main/java/org/jboss/resteasy/client/jaxrs/internal/ClientInvocation.java:[154,34] D:\rnd_work\jboss\resteasy\Resteasy\jaxrs\resteasyclient\src\main\java\org\jboss\resteasy\client\jaxrs\internal\ClientInvocation.java:154: type parameters of T cannot be determined; no unique maximal instance exists for type variable T with upper bounds T,java.lang.Object
Consulted the RestEasy developer mailing list and it seems This is a bug fixed in JDK 7[1]. Updating my JDK to the latest JDK 1.7 build, did the trick. Also i put the ant-contrib jar to my classpath variable. Because otherwise the build fail.s

Drools Java 7 support in Eclipse

I created a Drools project in Eclipse (Indigo) configured to use JRE 1.7. But I get an error pointing to my .drl file:
com/sample/DroolsTest$Message : Unsupported major.minor version 51.0
The com.sample.DroolsTest.Message class is imported by the .drl file. The Drools runtime was 5.2.1 (also tried with 5.3.0.Final).
Any help would be appreciated. Thanks.
This exception doesn't seem to have to do anything with Drools in particular, but is a generic Java error. It occurs if you try to execute a Java class with a JRE that is older than the JDK that was used to compile it. For example, if you compiled the class with a JDK7 and then tried to execute it with a JDK6, you would get this error.
Just to detail above answer and comment. I had both JRE6 and JRE7 installed, with JRE7 being the default. I had to do two things to remove the error from the drools sample project.
Set the JRE for the project to 1.6
Project properties->Java Build Path->Libraries. Remove JRE System Library 1.7 and Add Library->JRE System Library->Alternate JRE->JRE6
Set the compiler compliance level for the project at 1.6.
Project properties->Java Compiler->check Enable Project specific settings and set Compiler compliance level at 1.6.

Scala 2.8.0 problems on Windows 7

I installed scala 2.8.0 last night and I seem to be having some issues getting it running. If I type scala at the command prompt it comes up with the following:
> scala
Exception in thread "main" java.lang.NoSuchMethodError: scala.collection.mutable.ListBuffer.toList()Lscala/collection/immutable/List;
at scala.collection.TraversableOnce$class.toList(TraversableOnce.scala:399)
at scala.collection.mutable.ArrayOps.toList(ArrayOps.scala:34)
at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:33)
at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)
Anyone have any ideas? I'm on Windows 7 professional, with Oracle JRE 1.6.0_21
Did you set the SCALA_HOME environment variable to point to the correct directory?
Did you have an older version installed? If that's still on your path then it may be causing problems...
EDIT
Can you paste the contents of your PATH and CLASSPATH environment variables? Perhaps using pastie or pastebin if they're on the large side.
You should also update to Java 1.6.0_22 if at all possible, due to this bug which was present in update 21: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6969236
Turns out this problem occurred because I put the sbt-launch.jar in the lib directory for my scala installation. Once I moved it into another directory scala worked fine.