JSmooth 关于捆绑 JRE 的问题

发布于 2024-08-25 00:52:05 字数 762 浏览 11 评论 0原文

我正在尝试将 JRE 与我的 jar 文件捆绑在一起,以便我可以在任何 Windows 计算机上运行我的应用程序,无论它是否有 Java。 jsmooth 手册说:

为了使该选项正常工作,您必须将 JRE 放在 EXE 附近的目录中(通常位于名为“jre”或其他名称的子目录中)。生成 exe 后,它将首先尝试在提到的位置找到 JRE。如果在那里找不到,那么它将回退到正常的 jre 查找模式(在 Windows 注册表或常用环境变量中搜索 jre 或 jdk)。使用捆绑的 JRE 时没有 JVM 版本检查,因为打包程序应该为应用程序捆绑合适的 JVM。

这是否意味着 jre 子文件夹应该包含在 jar 中,成为其自己的单独 jar ,还是放到exe自带的文件夹里?如果它应该位于带有exe的文件夹中,我如何指定jre子文件夹的相对路径?

我的目录如下:

setup/

-jre/

-myprogram.exe

我尝试使用 ..\jre, .\jre, ..\setup\jre 在 GUI 屏幕上,但它们都不起作用。

任何想法或线索将不胜感激。非常感谢!

编辑:当我尝试 jre (我认为是 ..\jre)时,当我尝试运行它时,我从 Windows 收到以下错误消息“MyProgram.exe 已停止运行”。当我查看问题详细信息时,它显示 APPCRASH 并且故障模块名称是 jvm.dll

I'm trying to bundle a JRE with my jar file so that I can run my application on any windows computer, regardless of if it has Java or not. The jsmooth manual says:

For the option to work correctly, you have to put a JRE in a directory near the EXE (generally in a subdirectory called "jre" or whatever). Once the exe is generated, it will FIRST try to locate the JRE at the location mentioned. If it can't be found there, then it will fallback in the normal jre look-up mode (search for a jre or a jdk in the Windows registry or in commonly-used environment variables). There is no JVM-version check when using a bundled JRE, as the packager is supposed to bundle a suitable JVM for the application.

Does this mean that the jre subfolder should be included in the jar, be its own separate jar, or put in the folder that comes along with the exe? If it is supposed to be in a folder with the exe, how can I specify the relative path to the jre subfolder?

My directories are as follows:

setup/

-jre/

-myprogram.exe

I tried using ..\jre, .\jre, ..\setup\jre in the GUI screen, but none of them worked.

Any ideas or leads would be greatly appreciated. Thanks so much!

EDIT: when I tried jre (and ..\jre I think), I got the following error message from windows when I tried running it "MyProgram.exe has stopped running." When I look at the problem details, it says APPCRASH and the fault module name is jvm.dll

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

秋叶绚丽 2024-09-01 00:52:05

只需将“jre”文件夹放在exe旁边,然后在jsmooth的GUI中写入“jre”(不带引号)

just put the "jre" folder next to the exe, and write "jre" (without quotes) in the GUI of jsmooth

信仰 2024-09-01 00:52:05

作为替代方案,我建议使用成熟的开源项目 NSIS。您可以编写一个安装程序来下载并安装 JRE,然后创建快捷方式来运行您的程序。

以下是一些有用的链接:

As an alternative, I would suggest using the mature open source project, NSIS. You could write an installer that would download and install the JRE, and then create shortcuts to run your program.

Here are some useful links:

早茶月光 2024-09-01 00:52:05

您是否尝试过Launch4J(http://launch4j.sourceforge.net/),我们从JSmooth切换到了这个不久前,因为它更新了并且具有更多功能。

但是,请将 jre 文件夹与 .exe 放在同一文件夹中,然后使用 jre\ 作为其路径。不过,您需要确保 .exe 的工作文件夹是安装文件夹。并确保 jre 文件夹中有完整的 JRE。

Have you tried Launch4J (http://launch4j.sourceforge.net/), we switched from JSmooth to this a while ago, as it was more up to date and had more features.

But, put the jre folder in the same folder as the .exe, then use jre\ as the path to it. You'll need to make sure the working folder of the .exe is the installation folder though. And make sure you have a full JRE in the jre folder.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文