Writing Installation XML Files

What You Need

Your editor

In order to write your XML installation files, you just need a plain text editor. Of course it's always easier to work with color coded text, so you might rather want to work with a text editor having such a feature. Here is a list of free editors that work well :

If you are a developer and tend to write your own patches, extension or features to IzPack sources, or, if you wish to debug your compilation, installation and uninstallation, we recommend these IDE:

For the first one, JetBrains has granted us an Open Source License. All project members can ask the Licence Key to one of the project manager.

The other ones are well know open source projects (Just like us (smile) ). We provide a tutorial on how to develop/debug IzPack using Eclipse in the chapter Getting Started > How to develop and debug IpPack using Eclipse

Writing XML

Though you might not know much about XML, you have certainly heard about it. If you know XML you can skip this subsection as we will briefly present how to use XML.

XML is a markup language, really close to HTML. If you've ever worked with HTML the transition will be fast. However there are a few little things to know. The markups used in XML have the following form : <markup>. Each markup has to be closed somewhere with its ending tag : </markup>. Each tag can contain text and other markups. If a markup does not contain anything, it is just reported once : <markup/>. A markup can contain attributes like : <markup attr1="123" attr2="hello !"/>. Here is a sample of a valid XML structure :

<chapter title="Chapter 1">
  <section name="Introduction">
    This is the text of the paragraph number 1. It is available
    for the very low
    price of <price currency="dollar">1 000 000</price>.
  <section name="xxx">

You should be aware of the following common mistakes :

markups*are case sensitive : <markup> is different from <Markup>.
you*must close the markups in the same order as you create them : <m1><m2>(...)</m2></m1> is right but <m1><m2>(...)</m1></m2> is not.

Also, an XML file must start with the following header : <?xml version="1.0" encoding="iso-8859-1 standalone="yes" ?>. The only thing you should modify is the encoding (put here the one your text editor saves your files to). The standalone attribute is not very important for us.

This (brief !) introduction to XML was just meant to enable you to write your installation specification. For a better introduction there are plenty of books and articles/tutorials dealing with XML on the Internet, in book stores, in magazines and so on.

Variable Substitution

During the installation process IzPack can substitute variables in various places with real values. Obvious targets for variable substitution are resource files and launch scripts, however you will notice many more places where it is more powerful to use variables rather then hard coded values. Wherever variables can be used it will be explained in the documentation.

There are three types of variables:

You define your own variables in the installation XML file with the <variable> tag. How to do this is explained in detail later in this chapter.

Please note that when using variables they must always appear with a '$' sign as the first character, even though they are not defined this way.

The Built-In Variables

The following variables are built-in :

Environment Variables

Environment variables can be accessed via the syntax ${ENVvariable}. The curly braces are mandatory. Note that variable names are case-sensitive and usually in UPPER CASE.

Example: To get the value of the OS environment variable "CATALINA_HOME", use ${ENVCATALINA_HOME}.

Dynamic Variables

Dynamic variables can be defined in the installation XML with the <variable> tag inside the <dynamicvariables> element. The value of dynamic variables will be evaluated every time a panel is switched, i.e. between the panels. Dynamic variables can have a condition which will be evaluated first. If it's true, the value would be assigned, otherwise nothing happens to the variable.

As and addition to normal variables, the value of a variable can either be defined by using the value attribute or by using a child element called value.

Example1: To change a certain directory based on user input, use the following <variable name="test" value="/test/${USER_INPUT}" condition="hasuserinput" /> The condition has userinput has to be specified in the condition section of installation XML.

Example2: To comment out something in a xml file if a certain pack with id mycoolfeature is not activated, you could use "two" dynamic variables to create a xml comment or not.

<variable name="XML_Comment_Start" condition="!izpack.selected.mycoolfeature">
<variable name="XML_Comment_End" condition="!izpack.selected.mycoolfeature">
<variable name="XML_Comment_Start" value="" condition="izpack.selected.mycoolfeature" />
<variable name="XML_Comment_End" value="" condition="izpack.selected.mycoolfeature" />

The condition izpack.selected.mycoolfeature is generated automatically when a pack with id mycoolfeature was specified. You would now use ${XML_Comment_Start} and ${XML_Comment_End} in a file which should be parsed.

Parse Types

Parse types apply only when replacing variables in text files. At places where it might be necessary to specify a parse type, the documentation will mention this. Depending on the parse type, IzPack will handle special cases such as escaping control characters correctly. The following parse types are available:

Unless using braces to surround variable's name (${variable} or %{variable}}, the variable name can contain following characters: letters, digits, dots, dashes (minus) , underbars (_). Example: $this.is-my_variable

If you want to have two variables separated by character that is allowed to appear in variable name, for example: $major-version.$minor-version, then you must use braces, and the above example should look like: ${major-version}.${minor-version}.

The IzPack Elements

When writing your installer XML files, it's a good idea to have a look at the iZPACK installation DTD.

The Root Element <installation>

The root element of an installation is <installation>. It takes one required attribute : version. The attribute defines the version of the XML file layout and is used by the compiler to identify if it is compatible with the XML file. This should be set to 1.0 for the moment.

The Information Element <info>

This element is used to specify some general information for the installer. It contains the following elements :

Here is an example of a typical <info> section :

  <appname>Super extractor</appname>
  <appversion>2.1 beta 6</appversion>
    <author name="John John Doo" email="jjd@jjd-mail.com"/>
    <author name="El Goyo" email="goyoman@mymail.org"/>

Here is one where the privileges elevation is attempted on Windows Vista and Mac OS X :

        <author email="" name="Julien Ponge (project founder)"/>
        <author email="" name="The fantastic IzPack developers and contributors"/>
    <run-privileged condition="izpack.windowsinstall.vista|izpack.macinstall"/>

The Packaging Element <packaging>

This element allows to specify packaging options. If not specified, the default will be to create an all in one installer. This element will usually be used to create an installer which spans over multiple volumes, e.g. the output will be two CDs. The packaging-element contains the following elements:

Here's an example how to specify an installer which will create multiple volumes. In this example the volumes shall be CDs with 650 megabytes. There will be an additional free space of 150 megabytes on the first volume. This will result in the creation of an installer.jar and multiple installer.pak* files. The installer.jar plus installer.pak plus the additional resources have to be copied on the first volume, each installer.pak.<number> on several volumes.

  <packager class="com.izforge.izpack.compiler.packager.impl.MultiVolumePackager">
  <!-- 650 MB volumes, 150 MB space on the first volume -->
      <options volumesize="681574400" firstvolumefreespace="157286400"/>
  <unpacker class="com.izforge.izpack.installer.MultiVolumeUnpacker" />

The Variables Element <variables>

This element allows you to define variables for the variables substitution system. Some variables are built-in, such as $INSTALL_PATH (which is the installation path chosen by the user). When you define a set of variables, you just have to place as many <variable> tags in the file as needed. If you define a variable named VERSION you need to type $VERSION in the files to parse. The variable substitutor will then replace it with the correct value. One <variable> tag take the following attributes :

Here's a sample <variables> section :

  <variable name="app-version" value="1.4"/>
  <variable name="released-on" value="08/03/2002"/>

Here's a precise sample on how to use desktopshortcutcheckboxenabled and InstallerFrame.logfilePath variables:

  <variable name="InstallerFrame.logfilePath" value="$INSTALL_PATH
    <!-- This means that the log name will be My-install and that
  it will be stored at the root of the installation. -->
    <!-- Any path is fine. If value is set to "Default" then
  "$INSTALL_PATH/uninstall/install.log" is used. -->
    <!-- And if variable isn't defined then no log is written. -->
  <variable name="desktopshortcutcheckboxenabled" value="true"/>
    <!-- This automatically checks the "Create Desktop Shortcuts"
  button. Default value is "False". -->

The dynamic Variables Element <dynamicvariables>

This element allows you to define dynamic variables for the variables substitution system. In contrast to the static <variables, dynamic variables will be evaluated every time, a panel switch is done.

When you define a set of variables, you just have to place as many <variable> tags in the file as needed. Normally you would use the condition attribute to specify, when a certain value will be set.

One <variable> tag take the following attributes :

Here's a sample <dynamicvariables> section :

  <variable name="app-version" value="1.4" condition="mycondition1" />
  <variable name="app-version" value="1.4b" condition="!mycondition1" />
  <variable name="released-on" value="08/03/2002" />

The Conditions Element <conditions>

This element allows you to define conditions which can be used to dynamically change the installer, e.g. the panels shown, the variables set, files parsed, files executed and much more. When you define a condition it will get a type and an id. The id has to be unique. Conditions can be referenced based on this id (e.g. with the RefCondition).

There are several built-in types of conditions. At the time of writing this, Izpack has the following built-in types:

There are also boolean types to combine more than one condition:

When you define a set of conditions, you just have to write as many <condition> tags as you like. A condition can take the following attributes:

**; type: the type of the condition. For built-in types, this is the lowercase portion of the condition class

The condition element can have several child elements depending on the type of this conditions. E.g. the VariableCondition has a name and value child element to specify, which variable should have a certain value to fullfil this condition.

This is an example which defines four conditions, two VariableConditions, a JavaCondition and a AndCondition which will refer to two of the first conditions.

   <condition type="variable" id="standardinstallation">
   <condition type="variable" id="expertinstallation">
   <condition type="java" id="installonwindows">
 <returnvalue type="boolean">true</returnvalue>
 <condition type="and" id="standardinstallation.onwindows">
   <condition type="ref" refid="standardinstallation"/>
   <condition type="ref" refid="installonwindows" />

Note, from IzPack 3.11 on normally, you don't have to define the compound conditions because you can use a simple expression language. The language has the following operators:

Neverthless if you define really complex conditions it's much easier to define them using the xml structure.

More types of conditions can be defined by inheriting com.izforge.izpack.Condition class.

Built-in conditions

A number of built-in condition IDs are available for you.




The OS is Windows (any variant)


The OS is Windows XP


The OS is Windows Server 2003


The OS is Windows Vista


The OS is Windows 7


The OS is Linux (any variant)


The OS is Solaris (any variant)


The OS is Solaris (any x86 variant)


The OS is Solaris (any Sparc variant)

The Installer Requirements Element <installerrequirements>

This element allows to specify requirements for running the installation. This will be done based on conditions defined in the conditions section.

An installer requirement consists of a condition and a message which will be shown if the condition is not fulfilled. If so, the installer will show the message and exit after that.

Installerrequirements have the following attributes: - condition: an id of a condition defined in the conditions section - message: a message text or a langpack key defining which message should be shown before exiting the installer in case of a missing requirement.

   <installerrequirement condition="izpack.windowsinstall" message="This installer could only be run on Windows operating systems."/>

The GUI Preferences Element <guiprefs>

This element allows you to set the behavior of your installer GUI. This information will not have any effect on the command-line installers that will be available in future versions of IzPack. The arguments to specify are :

Here's a sample :

<guiprefs resizable="no" width="800" height="600"/>

Starting from IzPack 3.6, the look and feel can be specified in this section on a per-OS basis. For instance you can use the native look and feels on Win32 and OS X but use a third-party one on Unix-like platforms. To do that, you have to add some children to the guiprefs tag:

The available look and feels are:

If you don't specify a look and feel for a particular operating system, then the default native one will be used: Windows on Windows, Aqua on Mac OS X and Metal on the Unix-like variants.

The Liquid Look and Feel supports the following parameters:

The JGoodies Looks look and feel can be specified by using the variant parameters. The values can be one of:

Here is a small sample:

<guiprefs height="600" resizable="yes" width="800">
    <laf name="metouia">
        <os family="unix" />
    <laf name="looks">
        <os family="windows" />
        <param name="variant" value="extwin" />

The Substance look and feel toned-down themes can be specified using the variant parameter, with the value being one of: business, business- blue, business-black, creme, sahara, moderate, officesilver. We have reduced the choice to the toned-down themes since they are the only ones to actually look decent (the other families colors are way too saturated). Please consult https://substance.dev.java.net/docs/skins/toneddown.html for a gallery of the different toned-down themes.

Starting from IzPack 3.7, some characteristics can be customized with the <modifier> tag. There is a separate description in the `Advanced Features` chapter paragraph `Modifying the GUI`.

The Localization Element <locale>

This element is used to specify the language packs (langpacks) that you want to use for your installer. You must set one <langpack> markup per language. This markup takes the iso3 parameter which specifies the iso3 language code.

Here's a sample :

  <langpack iso3="eng"/>
  <langpack iso3="fra"/>
  <langpack iso3="spa"/>

The supported ISO3 codes are :h3. h4. h4. h4. h2. ISO3 code Language h4. h4. h4. cat Catalunyan chn Chinese cze Czech dan Danish glg Galician deu German eng English eus Basque fin Finnish fra French hun Hungarian ita Italian jpn Japanese mys Malaysian ned Nederlands nor Norwegian pol Polnish por Portuguese (Brazilian) prt Portuguese (European) rom Romanian rus Russian scg Serbian spa Spanish svk Slovakian swe Swedish ukr Ukrainianh3. h4. h4.h3. The Resources Element <resources> h3. Several panels, such as the license panel and the shortcut panel, require additional data to perform their task. This data is supplied in the form of resources. This section describes how to specify them. Take a look at each panel description to see if it might need any resources. Currently, no checks are made to ensure resources needed by any panel have been included. The <resources> element is not required, and no <res> elements are required within. The <resources> element is the only element besides the <packs> element that is taken into consideration in referenced pack-files (see `<packs> element`_ for more info)

You have to set one <res> markup for each resource. Here are the attributes to specify :

Here's a sample :

  <res id="InfoPanel.info" src="doc/readme.txt" parse="yes"/>
  <res id="LicencePanel.licence" src="legal/License.txt"/>

Please note that in general a resource id is unique. Thus if you define multiple resources with the same id the later definition (e.g. a resource defined in a referenced pack-file) will overwrite the previous definition. However there is an exception for packsLang.xml_xyz files (see `Internationalization of the PacksPanel`). If multiple packsLang-files were defined, all files will be merged into a single temporary file. This allows refpack files to provide their own internationalization-information.

You can define bundles of resources by using <bundle> You have to set a unique id for the bundle id. One bundle can be marked to be default: default="true"

You need to define a variable to set the name of the SystemProperty: resource.bundle.system.property

Here's a sample:

; <variables>

... <variable name="resource.bundle.system.property" value="BUNDLE_NAME" />

</variables> ... <resources> <

!-- bundle 1 --> <bundle id="bundle1" default="yes"> <res id="Heading.image" src="path1/HeadingImage.png" /> <res id="installer.langsel.img" src="path1/langselImage.png" /> </bundle> <!

-- bundle 2 -> <bundle id="bundle2"> <res id="Heading.image" src="path2/HeadingImage.png" /> <res id="installer.langsel.img" src="path2/langselImage.png" /> </bundle> <!- common resources --> <res id="resource.id" src="path.to.resource" /> ...

Resources will be then be loaded in the following order:


The Panels Element <panels> h3. Here you tell the compiler which panels you want to use. They will appear in the installer in the order in which they are listed in your XML installation file. Take a look at the different panels in order to find the ones you need. The <panel> markup takes the following attributes:

Here is a sample :

    <panel classname="HelloPanel"/>
    <panel classname="LicencePanel"/>
    <panel classname="TargetPanel"/>
    <panel classname="InstallPanel"/>
    <panel classname="UserInputPanel" id="myuserinput" condition="pack2selected" />
    <panel classname="FinishPanel" jar="MyFinishPanel.jar"/>

The following sections describe the tags available for a <panel> section. <help> - optional file for a help h3. The content of the help file is shown in a small window on the panel, when User clicks on the help button. The button is only shown, when a help in the language exists.

The <help> takes the following attributes :

Here's a sample :

<panel classname="HelloPanel">
  <help iso3="deu" src="HelloPanelHelp_deu.html" />
  <help iso3="eng" src="HelloPanelHelp_eng.html" />

<validator> - optional validation on idata h3. This validation is done, when going on for the next panel. It is also done in case of an automatic installation. The class must implement the interface com.izforge.izpack.api.installer.DataValidator.

The <validator> takes the following attributes :

Here's a sample :

<panel classname="UserInputPanel" id="jdbc.connection.parameters">
  <validator classname="JdbcConnectionValidator" />

<actions> - optional actions for the panel h3. Here you can define multiple actions that are done during the lifetime of the panel. The class must implement the interface com.izforge.izpack.installer.PanelAction. The actions are also called during an automated installation.

The <actions> tag has no attributes but has <action> markups with the following attributes :

Here's a sample :

<panel classname="UserInputPanel" id="jdbc.connection.parameters">
    <action stage="preconstruct" classname="ConnectionPreConstructAction" />
    <action stage="preactivate" classname="ConnectionPreActivateAction" />
    <action stage="prevalidate" classname="ConnectionPreVAlidateAction" />
    <action stage="postvalidate" classname="ConnectionPostValidateAction" />

The Packs Element <packs> h3. This is a crucial section as it is used to specify the files that need to be installed. The <packs> section consists of several <pack>, <refpack> and <refpackset> tags.

The <pack> takes the following attributes :

The <refpack> takes only one attribute file, which contains the relative path (from the installation compiler) to an externally defined packs-definition. This external packs definition is a regular IzPack installation XML. However the only elements that are used from that XML file are the <packs> and the <resources> elements. This enables a model in which a single developer is responsible for maintaining the packs and resources (e.g. separate packsLang.xml_xyz files providing internationalization; see `Internationalization of the PacksPanel`) related to the development-package assigned to him. The main install XML references these xml-files to avoid synchronization efforts between the central installation XML and the developer-maintained installer XMLs.

The <refpackset> tag can be used in situations were there is no predefined set of <refpack> files, but a given directory should be scanned for <refpack> files to be included instead. This element takes the following parameters:

An example:

<refpackset dir="" includes="**/refpack.xml" />

Internationalization of the PacksPanel h3. In order to provide internationalization for the PacksPanel, so that your users can be presented with a different name and description for each language you support, you have to create a file named packsLang.xml_xyz where xyz is the ISO3 code of the language in lowercase. Please be aware that case is significant. This file has to be inserted in the resources section of install.xml with the id and src attributes set at the name of the file. The format of these files is identical with the distribution langpack files located at $IZPACK_HOME/bin/langpacks/installer. For the name of the panel you just use the pack id as the txt id. For the description you use the pack id suffixed with .description.

An example:

    <res id="packsLang.xml_eng" src="i18n/myPacksLang.xml_eng"/>

The packsLang.xml_eng file: file:

    <str id="myApplication" txt="Main Application"/>
    <str id="myApplication.description" txt="A description of my main application"/>

The following sections describe the tags available for a <pack> section. <description> - pack description h3. The contents of the <description> tag describe the pack contents. This description is displayed if the user highlights the pack during installation. <depends> - pack dependencies h3. This can be used to make this pack selectable only to be installed only if some other is selected to be installed. The pack can depend on more than one by specifying more than one <depends> elements. Circular depedencies are not supported and the compiler reports an error if one occurs.

This tag takes the following attribute:

> Each pack can now specify an <updatecheck> tag. It supports a subset of ant fileset syntax, e.g.:

  <include name="lib/**" />
  <exclude name="config/local/** />

> If the paths are relative, they will be matched relative to $INSTALL_PATH. Update checks are only enabled if at least one <include> is specified. See com.izforge.izpack.installer.Unpacker for details. <file> - add files or directories h3. The <file> tag specifies a file (a directory is a file too) to include into the pack. It takes the following attributes:

A <additionaldata> tag can also be specified for customizing. <fileset>: add a fileset h3. The <fileset> tag allows files to be specified using the powerful Jakarta Ant set syntax. It takes the following parameters:

You specify the files with <include> and <exclude> tags that take the name parameter to specify the Ant-like pattern :

* : means any subdirectory

    • : used as a wildcard.

Here are some examples of Ant patterns :

There area set of definitions that are excluded by default file-sets, just as in Ant. IzPack defaults to the Ant list of default excludes. There is currently no equivalent to the <defaultexcludes> task. Default excludes are:


A <additionaldata> tag can also be specified for customizing. <parsable> - parse file(s) after installation h3. Files specified by <parsable> are parsed after installation and may have variables substituted.

One or more fileset tags can be used inside parsable to specify multiple files at once. <executable> - mark file executable or execute it h3. The <executable> tag is a very useful thing if you need to execute something during the installation process. It can also be used to set the executable flag on Unix-like systems. Here are the attributes :

A <args> tag can also be specified in order to pass arguments to the executable:

Here's an example installation file fragment:



    <pack name="Core" required="yes">


        <executable targetfile="$INSTALL_PATH/bin/compile" stage="never">
            <os family="unix"/>





The Native Element <native> h3. Use this if you want to use a feature that requires a native library. The native libraries are placed under bin/native/... There are 2 kinds of native libraries : the iZPACK libraries and the third-party ones. The IzPack libraries are located at bin/native/izpack, you can place your own libraries at bin/native/3rdparty. It is possible to place a native library also into the uninstaller.

It is usable from CustomActions. If one or more are referenced for it, the needed support classes are automatically placed into the uninstaller. To place it only on operating systems for which they are build, it is possible to define an OS restriction. This restriction will only be performed for the uninstaller. The markup takes the following attributes :

Note for developers: com.izforge.izpack.util.Librarian.loadLibrary() must be used to load custom native libraries, as it performs some housekeeping. <os> - make a library OS-dependent h3. The <os> tag can be used to restrict the inclusion into the uninstaller to a specific operating system family, architecture or version. The inclusion into the installer will be always done.

Here's a sample :

<native type="izpack" name="ShellLink.dll">
    <os family="windows"/>

The Jar Merging Element <jar> h3. If you adapt iZPACK for your own needs, you might need to merge the content of another jar file into the jar installer. For instance, this could be a library that you need to merge. The <jar> markup allows you to merge the raw content of another jar file into the installer and the uninstaller. It is necessary that the paths in the jars are unique because only the contained files of the jar are added to the installer jar, not the jar file self. The attributes are:

A sample :

<jar src="../nicelibrary.jar"/>

XInclude-style constructs

The xi:include element is used to include xml or text documents in your configuration files.

The xi:include element can be used anywhere in pretty much any of the xml files used by IzPack. It is supported by the javax DocumentBuilder. It follows the XInclude recommandation produced by the W3C (http://www.w3.org/TR/xinclude/) and should be able to be used as decribed in that document.

To use the xi:include, you have to specify the namespace xmlns:xi="http://www.w3.org/2001/XInclude" in your xml.

If a logical error appear in an included file, the line number shown will indicate the xinclude element in the main xml file.

The xi:include element has the following attributes:

For example the following use of xi:include

<?xml version="1.0" encoding="iso-8859-1" standalone="yes" ?>
<aaa xmlns:xi="http://www.w3.org/2001/XInclude">
  <xi:include href="does-not-exist.xml">

will result in

<?xml version="1.0" encoding="iso-8859-1" standalone="yes" ?>

if the file 'does-not-exist.xml' does indeed not exist. The xfragment element h1.

The xfragment element allows document fragments (xml documents without a single top level element) to be included. Simply use the xfragment as the top level element in the included document. It will be removed when the document is included.

e.g. If I want to use xi:include to include a file containing the following fragments:


I could use the xfragment element to enable it

<?xml version="1.0" encoding="iso-8859-1" standalone="yes" ?>

For replacing Maven properties in attributes to xi:include in the standard notation of IzPack you need to prepare your POM as follows:

Example: Packaging type pom is used in the POM:




and compile the installer from ${project.build.outputDirectory}/izpack-resources instead of src/main/izpack/.