Launch4j-FakeMain compiled by more recent version Java Runtime(class file version 55 0)this Java Runtime only recognizes class file version up to 52 0 - java

This is my first application that i try to execute exe.
I'm using launch4j to do this. After executing and trying to run, I get this error:
Blockquote
Launch4j - Exception in thread "main" java.lang.UnsupportedClassVersionError: FakeMain 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
I searched something about versions of java, so I checked my versions of java and they are the same.
That's my versions of java:
My versions of java in cmd
Maybe I did something wrong there?
Screen of Launch4j
I don't know what I can do. I spend all this day about fix this and nothing.
Error after try to run exe file

You have compiled the code with Java 11 as target. But your PC want's to execute the Java Code with Version 8, which is not possible.
Make sure you have installed the correct Versions and also make sure that the executable uses Java 11.
Here you can find the Java Versions mapped to the Runtime Versions: Java Version Numbers
The Article gives you also some information about how to compile and execute for the correct versions.

Related

Error when I run flutter doctor --android-licenses

Exception in thread "main" java.lang.UnsupportedClassVersionError: com/android/prefs/AndroidLocationsProvider 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
I tried also JDK 11 but it doesn't works.
How do I fix?
This error is telling us that our class was compiled at a higher version of Java than the version with which we tried to run it. More specifically, in this case we compiled our class with Java 11 and tried to run it with Java 8.
we have two ways we can resolve this error: compile our code for an earlier version of Java, or run our code on a newer Java version.
I think this website might help you https://www.baeldung.com/java-lang-unsupportedclassversion

Java: I cannot execute a compiled Java code

C:\Users\YusufGalip\Desktop\JavaDeneme>java deneme
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError: deneme 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
I got this error when i tried to run a compiled program.
It's probably compiled with a more recent version of java than the one you are attempting to use running the program. Do you have multiple versions of Java installed?
Try java -version and javac -version and compare the versions. If you use and IDE/editor where Java is configured in the settings, see that it points to the expected directory.
You've compiled your class with Java 11 (55) while you're still trying to execute/run them using Java-8(52).
Either compile the code using Java-8 or execute with Java-11.
The error clearly says that the compiler version was higher than the JVM version with which you are trying to run. That is why you are getting the error on running.
Java 8 uses major version 52
Java 11 uses major version 55
Reference:
https://en.wikipedia.org/wiki/Java_class_file#General_layout
=================
#DO THE FOLLOWING
change your path to point to a more recent version or if you are aware of the version using which the program was compiled, install the version and then execute the same command to run
1) run java -version now
2) Note down the version
3) complete the above #DO ****
4) execute 1) again
5) you should see a different or the latest version
6) run your program :) and you should be able to .... post your results
Finally I solved with your help.
There were 2 Java in my computer one of them is "Java SDK Tools 11" and the second one is "Java Runtime 8" I uninstalled the "Java Runtime 8" and it worked.Thank you for your help.

Does Japser Reports work with Java9

Im having trouble using Japser Reports with Java 9.
My JasperVersions:
<dependency.version.jasper>6.5.1</dependency.version.jasper>
When trying to build my Report i get the following error Message:
An internal error occurred during: "Building report".
java.lang.UnsupportedClassVersionError: my/path/to/my/class/User has been compiled by a more recent version of the Java Runtime (class file version 53.0), this version of the Java Runtime only recognizes class file versions up to 52.0
the Error occurrs probbably because Jasper does not Support java 9 Classes. I cant find any information on this topic, does anyone have a Idea how to write a workaround or did i do some other mistake?
EDIT:
After searching some more i realised that the problem only happens when im in the Designer in Eclipse, so it is most likely that eclipse itselve is not running in a JVM 9. I checked for the current version of java installed and it is java9, when i change the eclipse.ini file from:
-Dosgi.requiredJavaVersion=1.8
to
-Dosgi.requiredJavaVersion=1.9
i get a incompatible jvm error which says that im trying to start it with 1.8.0_161. How do i change my settings that my eclipse is acutally using my current JDK?
RESOLVED:
The error was that my Eclipse itselve only run in Java8. So my Application was building everything in Java9, like i wanted it to, but when i was inside the jasperReports Designer, the designer itselve run in java8. Thats why it crashed. The solution was to change the systemvariables and put my JavaPath over the Oracle JavaPath that for some reason had a higher priority.
Code was compiled in Java version 9 but executed in Java 8 JVM, which not necessarily works. Try compiling it in Java 8, or executing it in Java 9 JVM.

Exception while trying to execute .jar from unix korn shell

I'm new using Java and I want to execute a Java program from unix, While I'm trying to execute it I'm getting an the following error:
Exception in thread "main" java.lang.UnsupportedClassVersionError: javaapplicationtest/JavaApplicationTest : Unsupported major.minor version 52.0
I'm using:
java -jar JavaApplicationTest.jar
Do you have any idea how to correct that error?
You seem to have multiple JDK/JRE versions installed on your system.
The code you're trying to run is compiled for JRE 1.8, while the version of java on your PATH is 1.6.
You could do the following things to get your program to run:
Modify your environment variables such that when you try to execute java, it is picking up the 1.8 version. Look up how to do that on the specific UNIX flavor you are running.
If you are compiling the source code yourself, you could change the target runtime to be able to run this code on earlier versions.
javac -target 1.4 JavaApplicationTest.java

Unsupported major.minor 52.0 exception in Java

Given such an exception:
java.lang.UnsupportedClassVersionError: com/sun/tools/javac/Main : Unsupported major.minor version 52.0
And I know this is because that the JDK and JRE are not compatible. However, when I type in:
which java
The output is:
/usr/java/jdk1.6.0_24/bin/java
And when typing in:
which javac
The output is:
/usr/java/jdk1.6.0_24/bin/javac
It is the compatible in version. So what's the problem?
The problem is typically caused by this sequence:
Code is compiled with new JDK, and "target" set to current version of Java.
Attempt to run the code with an older JDK or JRE.
In this case, minor version 52 means that something has been compiled with a Java 8 JDK, and with Java 8 as the target platform, and that you are attempting to run it on an older JRE / JDK.
You could also have gotten a JAR file from somewhere else that was compiled for Java 8.
To solve your problem, you need to figure out:
which class file or files have the version number problem (the exception message should tell you the first one ...),
where the class file came from (from a JAR file? from the file system?), and then
how come it was compiled with Java 8 though you thought you were compiling with Java 6.
It is an indisputable fact that the class that won't load was compiled using Java 8 (or later) compiler. You need to figure out why, and then either recompile it with the older JDK, or run it with Java 8.
it says version 52.0 so you should install java 8.
Check if tools.jar used during compilation complies with the JRE set. If you are on eclipse, verify the versions as:
Goto Window->Preferences
Check Ant Runtime by selecting Runtime under Ant in the left pane. Check the Global Entries under classpath tab. You can see the version in folder path.
On the left pane check installed JREs under Java. Check the version.

Categories