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

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.

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.

Play Framework InjectedRoutesGenerator Error

I have created new Play + Scala project using latest typesafe activator and when trying to import in IntelliJ IDE I was getting below error,
info] Loading project definition from E:\Personal\Scala Workspace\DeployZip\project
E:\Personal\Scala Workspace\DeployZip\build.sbt:18: error: not found: value routesGenerator
routesGenerator := InjectedRoutesGenerator
^
[error] Type error in expression
Consult IDE log for more details (Help | Show Log)
What are the possible reasons for this error?
I have installed jdk 1.8 and now I am able to create project successfully without any error.
But when I tried to run play application using
activator run
I was getting below error now,
java.lang.UnsupportedClassVersionError: org/webjars/WebJarExtractor$Cache : Unsupported major.minor version 51.0
According to this article, I think Unsupported major.minor version 51.0 means that your play application were compiled with Java 1.7 (version 51), but you have Java 1.8 (version 52) installed instead, so you got this error. I'd suggest that you refer to this article for how you could switch between different Java versions.
I was having the error that said Unsupported major.minor version 52.0, and after I installed the latest one (Java 1.8) it was solved.
Hope this helps.
Here is what I've done to solve the issue. Even if you install the java 1.8 it is not sufficient. You have to update the 'path' and 'JAVA_HOME'.
After you install, try to set the jdk1.8 path in the PATH of the environment variables. Also make sure that if you have other versions of the java in the PATH then put the jdk 1.8 path prior to the previous version of java. Or just in case put it in the very beginning of the paths.
I had this same issue. Everything worked after I upgraded Intellij to the latest version (maybe my outdated version used JDK1.7, while activator used 1.8?).

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

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

Accessing a library (compiled using higher jdk) gives exception when accessed from lower JRE

I created a jar file (compiled it using jdk1.7). When I used this jar in a project(using JRE 1.6), I get the following exception- unsupported major.minor version 51.0 (I suppose 51.0 is meant for jdk1.7). I used eclipse IDE for all these operations.
I am wondering whether this exception is a norm (in this kind of situation) or is it coming just because class loading in eclipse works differently
This is expected. Bytecode specifically compiled for a java version, can't be executed on a lower version. This is because it might have bytecode instructions and/or features not supported by an earlier Java version.
To compile for a lower java version, you need to explicitly specify the target version of compilation, eg:
javac -target 1.6 ...
In Eclipse you can set this under Properties > Java Compiler > "Generated .class files compatibility". However in general it is advisable to just use a Java 6 compiler to make sure you are actually only using features and libraries included in Java 6.
Class loading is performed by the JVM, both within eclipse and outside of it. This error simply indicates the the file format of class files has changed in Java 7, and a Java 6 virtual machine does't know the class file format from the future.
You can instruct the Java compiler to use the class file format of a previous java version (in eclipse, you can find the setting under Properties -> Java Compiler -> JDK compliance).
In addition, you'll want to verify that you only use API elements that also existed in JDK 6.

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.