如何创建 .exe 文件而不是 .exe 和 jre 文件夹

huangapple go评论67阅读模式
英文:

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.

如何创建 .exe 文件而不是 .exe 和 jre 文件夹

答案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/

huangapple
  • 本文由 发表于 2023年5月11日 17:14:26
  • 转载请务必保留本文链接:https://go.coder-hub.com/76225972.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定