Updating java JRE to match what is compiled with JDK [duplicate] - java

This question already has answers here:
How can I get Java 11 run-time environment working since there is no more JRE 11 for download?
(4 answers)
Closed 3 years ago.
I'm trying to run a java application that I have compiled using the IntelliJ IDEA, by the commandline running the following command:
java myApp.Main
This gives me the following error:
"Exception in thread "main" java.lang.UnsupportedClassVersionError: FlightConverter/Main 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"
In IntelliJ the JRE set to run in the run configuration is: /Java/jdk-11.0.3, but I get the error above when I try to run it. When i type java -version in cmd I get "1.8.0_211"
I cant really seem to find out how to update my current JRE to match what is used by the compiler either? It seems I'm only able to find JRE 8.xx online

I'm sure you can get location of java 8 from local system and set that as a compiler in IntellIJ IDE.. This way both your system and IDE works only on Java 8 and everything will work fine...
Hope this helps...

Related

java.lang.UnsupportedClassVersionError: io/github/spencerpark/ijava/IJava has been compiled by a more recent version of the Java Runtime [duplicate]

This question already has answers here:
How to fix java.lang.UnsupportedClassVersionError: Unsupported major.minor version
(51 answers)
Closed 1 year ago.
The error I met is the same as OSError: [Errno 8] Exec format error: '/Users/CodingStark/opt/anaconda3/share/jupyter/kernels/java/ijava-1.3.0.jar'. However, the answer of this post does not help me to resolve the issue.
The error is
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError: io/github/spencerpark/ijava/IJava 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
I tried to change "java" in the argv array described in that post to "/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/bin/java" but still the same error appears. I checked the java version by java -version and it gives openjdk version "11.0.9.1". Do you have any idea why it is not working? Thank you!
The software that you are trying to run is compiled using Java 9.
You are trying to run it with Java 8. This is why error is occurring.
I checked the java version by java -version and it gives openjdk version "11.0.9.1".
This means the software you are trying to run overrides your system settings like by setting another version of Java.
You may need to check the config files and try to find Java settings.
Probably exactly this is causing an issue:
I tried to change "java" in the argv array described in that post to "/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/bin/java"

Ant media server: Exception in thread "main" java.lang.UnsupportedClassVersionError [duplicate]

This question already has answers here:
How to fix java.lang.UnsupportedClassVersionError: Unsupported major.minor version
(51 answers)
List of Java class file format major version numbers?
(7 answers)
Closed 1 year ago.
I have downloaded the installation files of the ant media server and now I am following this tutorial to try to run the server.
So I've run this command:
./start.sh
But, I keep getting this error:
Exception in thread "main" java.lang.UnsupportedClassVersionError:
org/red5/server/Bootstrap 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 53.0
Here's the whole stack trace:
Running java -version gives me this:
Running javac -version gives me this:
The OS info is:
Any idea what's going-on?
I have tried installing java 8 by following the commands here:
So now when I run java -version, I get this:
But, I still get the same error.
FYI, when I run this command:
sudo update-alternatives --config java
This is what I get:
I have selected option 1.
I have run the same commands for javac.
So now when I run java -version, I have this:
And when I run javac -version, I have this:
And I am still getting the same error.
The JAVA_HOME environment variable is also set to:
JAVA_HOME=/usr/lib/jvm/java-8-oracle
The error is telling you that the class was compiled with a newer version than the one you're running.
You need to run it with Java 11 (version 55) but you are using Java 9 (version 53).

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.

Error while checking the java version in command prompt [duplicate]

This question already has answers here:
How to set the environment variables for Java in Windows
(17 answers)
Closed 5 years ago.
On my windows 7, 64 bit pc, I have installed java but while typing java -version in command prompt it shows java' is not recognized as an internal or external command, operable program or batch file.".and there is no java folder in program files even.The java version which i have installed is 8 and it is 64bits.
Try setting the environment variables.
The answer can be found on this SO page.
You must install the latest version of JDK from here:
Download JDK From Here
After Installing the latest version follow these steps :
Setting Path in Java
Hope this will help you out.

java.lang.UnsupportedClassVersionError: [duplicate]

This question already has answers here:
How to fix java.lang.UnsupportedClassVersionError: Unsupported major.minor version
(51 answers)
Closed 6 years ago.
I have developed a small project in eclipse which makes use of Java6. But I want to run the same project in hpux system which has java1.5. When I try to run it is throwing the error :
java.lang.UnsupportedClassVersionError:.
Then I have changed the eclipse Java compiler to java1.5 and jre to 1.5.0_12 then recompiled my project. After that I have deployed once again in hpux system but still it is throwing the same error. I used ant to compile in hpux system. It compiled successfully and produced jar. But while running it is throwing the same error.
Any help is highly appreciated.
Many Thanks in Advance.
You can use the target config option with a value of 1.5 so that the compiled classes are compiled to run against JVM 1.5. Also, make sure that 1.5 is the correct jvm on hpux by manually running java -version.
Read more details here
Use the cross-comilation options when compiling, specifying a source/target of 1.5, and a bootclasspath pointing to a 1.5 rt.jar

Categories