7

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

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.

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

我的目录如下:

设置/

-jre/

-myprogram.exe

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

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

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

4

3 回答 3

1

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

于 2013-08-01T08:43:10.067 回答
0

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.

于 2010-05-19T16:20:59.630 回答
0

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

以下是一些有用的链接:

于 2010-05-14T18:22:20.770 回答