Search code examples
javajarexelaunch4j

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


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


Solution

  • 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.