Search code examples
javaswingjarexe

How to create exe file instead of exe and jre folder


I want to deploy my java application, and I want to make a self-contained .exe that simply requires downloading Mario.exe and double-click to run. I'm wondering if there is a way to "put" the jre folder in the .exe?

All of the jar to exe methods I have tried so far mostly I create a jar, then use Launch4j which results in a zip file containing: Mario.exe and a jre folder with the JVM embedded, which is required to run the application.

My goal is I want Mario.exe to run without the jre folder.

folder and exe


Solution

  • It's because tool like Launch4j is wrapper tool and not actually convert your java bytecode to machine code to run without JRE.
    You should check out tool native-image of Graalvm JDK, it has free community edition which can install by follows instruction here https://www.graalvm.org/22.2/docs/getting-started/windows/