Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run (exe) java-8 application in java-11

Tags:

I have made a java application using jdk 8 and then made an executable file from the jar.

Then I updated my system to java 11, and deleted all older java versions from my system, and when I run this app from exe file it can't run and takes me to web browser and asks me to download java 8. But if I run the jar using java -jar app.jar it runs normally on java 11.

I've used launch4j to make an exe out of jar, and there is no possibility to pick java 11 as the newest version.

So how can I make this exe run on java 11?

like image 915
wdc Avatar asked Jan 02 '19 14:01

wdc


People also ask

Can a Java 8 app run on Java 11?

The class files created by Java 8 are still executable in Java 11; however, there have been other changes in the Java runtime (library changes, etc.) that might require modification of the code. These modifications may be made in Java 8 and compiled with Java 8 making it compatible with the Java 11 runtime.


1 Answers

Unless you have compiled EXE with latest launch4j 3.12 you are most likely stuck on Java 8. Support for newer JDK was added in ticket #177 Launch4J doesn't accept Java 9 JDK.

The solution would be to recompile EXE with latest launch4j and hope it works with Java 11. Alternatively you could create a BAT file running java -jar app.jar but that goes against the whole point of launch4j.

like image 149
Karol Dowbecki Avatar answered Nov 14 '22 21:11

Karol Dowbecki