Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 ? (eclipse) but is specifically about bundling a JRE as well.

I am currently working on building an MSI for my product so it can be installed as an add-on with Windows Home Server. The installer must be a silent MSI installer.

My product depends on 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.

Initially I tried installing the JRE anyway as a first step. 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.

So I changed to copying the JRE files instead. I have managed to create an MSI with all the items, but it comes in at a whopping 60MB! That's around 33MB for my app and the rest is the JRE. My normal setup.exe which bundles the JRE is about 30MB, so I am assuming compression is much better in the latter case (I also use Pack200 compression there).

I am using WiX to build the MSI and have compression turned on.

What is the best way to bundle a JRE, with dependent application, inside an MSI?

like image 592
Dan Gravell Avatar asked Oct 10 '22 11:10

Dan Gravell


1 Answers

IMHO you should simply add whole (unpacked) JRE directory to your installer files. Then run your JRE from the given, known path. Many products (for example DB2, Oracle 11g and even WebSphere Application Server) are doing it exactly like this.

like image 142
zacheusz Avatar answered Oct 13 '22 01:10

zacheusz