gpt4 book ai didi

java - 如何使用安装程序创建 exec 并自动运行文件

转载 作者:行者123 更新时间:2023-11-30 02:11:06 28 4
gpt4 key购买 nike

最近我用JavaFX开发了一个jar文件。现在我的问题是如何将其转换为可执行文件,以便它可以在其他没有安装任何JDK的系统上安装和运行。

此外,当客户端系统从关闭或 hibernate 状态启动时,我希望可执行文件自动运行。

我在 Google 上进行了很多搜索,并在互联网上找到了内容,但我没有找到如何实现这一目标。

最佳答案

how I can convert it into exec with the install so it can install into other systems which do not have any JDK on that system

您始终需要 JRE 来运行 jar 文件,这是没有办法解决的。然而,由于几乎所有系统都会安装 JRE 的假设不再正确,因此现在的正常做法是将整个 JRE 与安装程序捆绑在一起并使用 launch4j创建一个 exe 文件。

and another thing I want is that when client system start from shutdown or hibernate exec should run automatically.

您无法在 Java 级别执行此操作,因此这取决于您运行的操作系统。在 Windows 上,您可以使用 sc.exe to create a windows service from the executable ,或者您可以将其放入相关用户的启动文件夹中。

关于java - 如何使用安装程序创建 exec 并自动运行文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50099001/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com