简体   繁体   English

如何将 Java 相关应用程序与 MSI 中的 JRE 捆绑在一起

[英]How to bundle a Java dependent application with a JRE in an MSI

This is similar to How can I create a.msi file for a Java program?这类似于How can I create a.msi file for a Java program? (eclipse) but is specifically about bundling a JRE as well. (eclipse) ,但也专门用于捆绑 JRE。

I am currently working on building an MSI for my product so it can be installed as an add-on with Windows Home Server.我目前正在为我的产品构建一个 MSI,以便它可以作为 Windows 家庭服务器的附加组件安装。 The installer must be a silent MSI installer.安装程序必须是静默 MSI 安装程序。

My product depends on Java 1.6.我的产品依赖于 Java 1.6。 I want to bundle Java inside the MSI but not necessarily install the JRE, simply copying the files to my product directory and executing from there would be fine.我想在 MSI 中捆绑 Java 但不一定安装JRE,只需将文件复制到我的产品目录并从那里执行就可以了。

Initially I tried installing the JRE anyway as a first step.最初我尝试安装 JRE 作为第一步。 I used the JRE's silent installer , however it turned out that because the JRE installs itself via another MSI, under the covers, the one-MSI-installation-running-at-once rule was broken, and so a JRE could not be installed.我使用了JRE 的静默安装程序,但事实证明,由于 JRE 通过另一个 MSI 自行安装,在幕后,one-MSI-installation-running-at-once 规则被破坏,因此无法安装 JRE。

So I changed to copying the JRE files instead.所以我改为复制 JRE 文件。 I have managed to create an MSI with all the items, but it comes in at a whopping 60MB.我已经设法创建了一个包含所有项目的 MSI,但它的大小高达 60MB。 That's around 33MB for my app and the rest is the JRE.我的应用程序大约有 33MB,而 rest 是 JRE。 My normal setup,exe which bundles the JRE is about 30MB.我的正常设置,捆绑了 JRE 的 exe 大约是 30MB。 so I am assuming compression is much better in the latter case (I also use Pack200 compression there).所以我假设在后一种情况下压缩要好得多(我在那里也使用 Pack200 压缩)。

I am using WiX to build the MSI and have compression turned on.我正在使用 WiX 构建 MSI 并打开压缩。

What is the best way to bundle a JRE, with dependent application, inside an MSI?在 MSI 中捆绑 JRE 和相关应用程序的最佳方式是什么?

IMHO you should simply add whole (unpacked) JRE directory to your installer files.恕我直言,您应该简单地将整个(解压缩的)JRE 目录添加到您的安装程序文件中。 Then run your JRE from the given, known path.然后从给定的已知路径运行您的 JRE。 Many products (for example DB2, Oracle 11g and even WebSphere Application Server) are doing it exactly like this.许多产品(例如 DB2、Oracle 11g 甚至 WebSphere Application Server)都是这样做的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM