【问题标题】:JSmooth question on bundling a JRE关于捆绑 JRE 的 JSmooth 问题
【发布时间】:2011-01-27 17:47:17
【问题描述】:

我正在尝试将 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

【问题讨论】:

  • “jre”怎么样?除非另有说明,否则 Windows 假定路径相对于当前文件夹。
  • 当我使用 .\jre 时,程序将其切换为纯 jre,但仍然无法正常工作。不过我会再试一次

标签: java windows exe software-distribution launcher


【解决方案1】:

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

【讨论】:

    【解决方案2】:

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

    这里有一些有用的链接:

    【讨论】:

      【解决方案3】:

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

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

      【讨论】:

        猜你喜欢
        • 2011-07-21
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-08-04
        • 2021-01-22
        • 1970-01-01
        • 2012-07-06
        • 1970-01-01
        相关资源
        最近更新 更多