We need you!

Icon

The IzPack documentation needs work, and you are invited to edit it!

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Using System Properties As Variables

System properties given on the command line can be directly included as IzPack variables when using the SYSTEM_ prefix followed by the system property name in the variable name, and substituting alls occurences of '.' by '_'. No substitution happens in this case, if the according system variable cannot be found in the execution environment. This means that for example the string ${SYSTEM_java_version} gets inserted into the output as a literal string, instead of replacing it by an environment value.

Examples:

  • java.version would be available as $SYSTEM_java_version
  • os.name would be available as $SYSTEM_os_name

 

are directly assigned to variables using the following syntax, provided the system property is variable.name:


IzPack 5.0 and later:

${SYSTEM[variable.name]}

More examples, provided -Dfeature.Enabled=true is added to launching the installer on the command line:

Code Block
titleExample 1
languagexml
<variables>
  <variable name="featureEnabled" value="${SYSTEM[feature.Enabled]}" />
</variables>

<conditions>
  <condition type="variable" id="isFeatureEnabled">
    <name>featureEnabled</name>
    <value>true</value>
  </condition>
</conditions>

 is equivalent to:

Code Block
titleExample 2
languagexml
<conditions>
  <condition type="variable" id="isFeatureEnabled">
    <name>SYSTEM[feature.Enabled]</name>
    <value>true</value>
  </condition>
</conditions>


IzPack 4 and earlier (obsolete handling in IzPack 5.0 for backward compatibility):


${SYSTEM_variable_name}

If the variable name contains '.' characters they got to be replaced by '_' here.

More examples, provided -Dfeature.Enabled=true is added to launching the installer on the command line:

Code Block
titleExample 1
languagexml
<variables>
  <variable name="featureEnabled" value="${SYSTEM_feature_Enabled}" />
</variables>

<conditions>
  <condition type="variable" id="isFeatureEnabled">
    <name>featureEnabled</name>
    <value>true</value>
  </condition>
</conditions>

 is equivalent to:

Code Block
titleExample 2
languagexml
<conditions>
  <condition type="variable" id="isFeatureEnabled">
    <name>SYSTEM_feature_Enabled</name>
    <value>true</value>
  </condition>
</conditions>

For Izpack before 5.0.0-rc2, no real substitution on demand happens but all system properties known to the JVM are added as IzPack variables by default when the installer starts.