izpack

Wrong directory of the bat file?


I am trying to create a installer with IzPack. I am trying to execute a batch file before the installation.

install.xml

<izpack:installation version="5.0" 
                     xmlns:izpack="http://izpack.org/schema/installation" 
                     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
                     xsi:schemaLocation="http://izpack.org/schema/installation http://izpack.org/schema/5.0/izpack-installation-5.0.xsd">


    <guiprefs width="640" height="480" resizable="yes"/>
     <variables>
         <variable name="DesktopShortcutCheckboxEnabled" value="true"/>
    </variables>

    <locale>
        <langpack iso3="eng"/>
    </locale>

    <resources>
        <res id="ProcessPanel.Spec.xml" src="ProcessPanel.Spec.xml"/>
        <res id="shortcutSpec.xml" src="shortcutSpec.xml"/>
        <res id="LicencePanel.licence" src="License.txt"/>
        <res id="InfoPanel.info" src="Readme.txt"/>
    </resources>

    <panels>
        <panel classname="HelloPanel"/>
        <panel classname="ProcessPanel"/>
        <panel classname="LicencePanel"/>
        <panel classname="TargetPanel"/>
        <panel classname="PacksPanel"/>
        <panel classname="InstallPanel"/>
        <panel classname="ShortcutPanel"/>
        <panel classname="FinishPanel"/>
    </panels>

    <packs>
        <pack name="Base" required="yes">
            <description>The base files</description>
            <file src="Readme.txt" targetdir="$INSTALL_PATH"/>
            <file src="License.txt" targetdir="$INSTALL_PATH"/>
            <file src="phone.ico" targetdir="$INSTALL_PATH"/>
            <fileset dir="lib" targetdir="$INSTALL_PATH\lib">
                <include name="**"/>
            </fileset>
        </pack>
    </packs>

    <native type="izpack" name="ShellLink.dll"/>
    <native type="3rdparty" name="COIOSHelper.dll" stage="both">
        <os family="windows"/>
    </native>
</izpack:installation>

ProcessPanel.Spec.xml

<?xml version="1.0" encoding="UTF-8" ?>
<processing>                   
     <job name="doxyz">
         <os family="windows" />
         <executefile name="$INSTALL_PATH/scripts/mytest.bat">
             <arg>doit</arg><arg>$variable</arg>
         </executefile>
     </job>            
     <onFail previous="true" next="false" />
     <onSuccess previous="false" next="true" />
</processing>

At the compile time, I don't get any error! But when I am executing the install.jar and when I open the ProcessPanel I am getting the following error: enter image description here

I used the:

izpack-dist-5.0.6

to generate the installer and my java version is:

java version "1.8.0_66" Java(TM) SE Runtime Environment

(build 1.8.0_66-b18) Java HotSpot(TM) 64-Bit Server VM (build 25.66-b18, mixed mode)


Solution

  • I would call this an expected behaviour.

    The file $INSTALL_PATH/scripts/mytest.bat cannot be found because it isn't probably preinstalled due to the activation order of the panels. ProcessPanel is shown before InstallPanel, but InstallPanel is the one installing the file. Problems of this kind the compiler does NOT complain about, you must care about them on your own. It is more or less a problem of the logic introduced by the installer description, not of IzPack.