英文:
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?
我想部署我的Java应用程序,我想制作一个自包含的 .exe 文件,只需下载 Mario.exe 并双击运行。我想知道是否有一种方法可以将 jre 文件夹放入 .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.
到目前为止,我尝试过的所有将jar转换为exe的方法大多都是创建一个jar文件,然后使用Launch4j,结果是一个包含 Mario.exe
和嵌入了JVM的 jre
文件夹的zip文件,这是运行应用程序所需的。
My goal is I want Mario.exe
to run without the jre
folder.
我的目标是希望 Mario.exe
能够在没有 jre
文件夹的情况下运行。
英文:
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.
答案1
得分: 1
因为像Launch4j这样的工具是包装工具,实际上不会将您的Java字节码转换为无需JRE即可运行的机器代码。您应该查看Graalvm JDK的native-image
工具,它有免费的社区版本,可以按照这里的说明安装:
https://www.graalvm.org/22.2/docs/getting-started/windows/
英文:
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/
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论