【发布时间】: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