Marking files for execution

<executable> - mark file as executable and optionally execute it

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.

Files must be first added to the pack using <singlefile><file> or <fileset> before they can be marked executable.

The permission changes (Unix) and/or execution happens before afterpack listeners are executed.







Relative or absolute target path of a pack file added before, which should reeceive executable permissions or which should be executed.

May contain IzPack variables resolved during installation.

Example: $INSTALL_PATH/bin/

(required, if no nested fileset is used) 

File path


bin or jar (the default is bin)


"bin" | "jar" 


If the executable is a jar file, this is the class to run for a Java program


A valid Java class within the jar file


Specifies at which stage when to launch the executable:

  • never 
    will never launch it (useful to set the +x flag on Unix)
  • postinstall 
    just after the installation of the given pack is done (not whole of the installation - IZPACK-1291).
  • uninstall 
    when the application is uninstalled. The executable is executed before any files are deleted.


"never" | "postinstall" | "uninstall" 


specifies what to do when an error occurs:

  • ask (default) will ask the user what to do
  • abort will abort the installation process
  • warn will just tell the user that something is wrong
  • ignore don't tell the user, just continue


"ask" | "abort" | "warn" | "ignore" 


Whether the file will be kept after execution


"true" | "false" 


Limits this action on a particular OS family, works like for <file>


No recommended to use any longer, use the nested <os> tag, instead.


ID of a condition which has to be fulfilled to execute this file


A valid condition ID

Nested Elements

  • <os> - restrict parsing depending on the target operating system, see the OS Restriction element
  • <args>
    Pass one or more arguments with nested <arg> tags  (one <arg> tag per argument) to the executable
    Attributes: value - the argument value
    <args><arg value="-version"/></args>

<pack name="core" required="yes">
	<file targetdir="$INSTALL_PATH" src="projectNotification.bat" />
	<executable targetfile="$INSTALL_PATH/projectNotification.bat" type="bin" stage="postinstall" failure ="warn" keep="true" >
		<os family="windows" />
			<arg value="-version"/>

Slashes get special handling (see attribute targetfile of tag <parsable>.)

If you need to preserve a slash in front of an argument you will need to quote the slash.

<os family="windows" />
  <arg value="\/arg"/>

Executing Multiple Files

One or more <fileset> tags can be used to specify multiple files executable at once. The <fileset> which can be used here does not have all of the attributes and nested tags of a Pack FileSet. Only the attributes targetdir, includes and excludes and the children <include> and <exclude> are allowed. The children <include> and <exclude> only can have the attribute name.

There can be filesets defined here without any attribute, but just one or more includes (targetDir defaults to "${INSTALL_PATH}" in that case).

The order of execution is not defined when multiple files are specified in the include.

If you want the the files executed in a certain order, use multiple <execute> sections.
There is no access to the filesystem for a <parsable> fileset, but just to files that are packed into the installer at compile time.

See the example below.

<pack name="core" required="yes">
	<file targetdir="$INSTALL_PATH" src="projectExtractor.bat" >
	<file targetdir="$INSTALL_PATH" src="projectInstaller.bat" >
	<executable type="bin" stage="postinstall" failure ="warn" keep="true">
		<os family="windows" />
		<fileset targetdir="$INSTALL_PATH" includes="fileCleaner.bat,projectNotification.bat" />

Note that there is no guarantee that fileCleaner.bat will run before projectNotification.bat.