0

I am a beginner in coding and I started to code my first real program ever, just a simple math game. Now I am trying to get the code to an exe file. I use eclipse newest version for coding and Launch4j v.3.14 for extracting the exe. file. my java versions are :

java version "1.8.0_281"

Java(TM) SE Runtime Environment (build 1.8.0_281-b09)

Java HotSpot(TM) 64-Bit Server VM (build 25.281-b09, mixed mode)

if I try to open the final exe file, nothing happens, if I try to run the file due Launch4j I get the following error in the log

Error: LinkageError occurred while loading main class start java.lang.UnsupportedClassVersionError: start has been compiled by a more recent version of the Java Runtime (class file version 59.0), this version of the Java Runtime only recognizes class file versions up to 57.0

What should I do? I need help, please.

tr3x
  • 21
  • 3

2 Answers2

0

The error message means that your JRE is not able to load a class with a class file (or bytecode) version 59.0. This version was introduced in Java 15 so I recommend you use it to run your application.

Here is an overview of bytecode versions and their corresponding Java versions.

To describe the issue in more detail, the problem is that you are trying to run an application compiled by a newer Java version than that of your runtime.

You can actually solve it the other way round, by compiling the application in a lower version of JDK, but that requires you to have access to the source code. Updating the runtime is usually easier.

EDIT

As Johannes Kuhn suggested, Java 15 has reached its EOL, you should use Java 16 as the current version and switch to Java 17 as soon as possible as this will be the next LTS (Long Term Support) version.

0

Keep compile your code with an earlier version of java. Also, you can run your code in the newest java version.

You can move newer JDK by command line.

  • Download newer version of Java JDK
  • Go to JAVA_HOME environment variables and set the PATH with new JDK.