Search code examples
javaizpackwinrun4j

Can I install a file using Izpack 5 without it being part of the install.jar built by izpack


My installation widget.zip zipfile contains the following:

  • 32bitJava
  • install.jar
  • widgetinstaller.exe
  • widgetinstaller.ini
  • widgetinstaller.ico

To summarize:

  • 32bitJava is a 32bit JRE downloaded from Oracle
  • install.jar is the installer created by Izpack
  • widgetinstaller.* are created by winrun4j providing an exe wrapper for the installer.

So with this setup I can install my application without user having to have a java runtime already installed.

However once installed the actual application also needs a java runtime to actually run. So at the moment a copy of 32bitJava is included as part of the izpack install, i.e it exists in install.jar and is installed at installation time.

But this means I have two copies of the JVM, and because the 32bitJava is larger than my actual application makes my download much too large.

So how can I copy the 32bitJava folder into the installation during/after installation instead of having to include it in install.jar ?


Solution

  • You want to do a "loose" pack for the JVM. A loose pack doesn't need to contain the files it installs, so it could copy the file from the zip into place, instead of using one embedded in the jar.

    <pack id="java" name="java" required="yes" preselected="yes" loose="true">
      ...
      <executable ...>
        <!-- something appropriate to install java -->
      </executable>
    </pack>