RegistryInstallerListener / RegistryUninstallerListener

The RegistryInstallerListener and RegistryUninstallerListener provide Windows registry access during an installation or uninstallation.

Due to the lack of Unicode support, there is no support from the IzPack project of this feature for Windows 95, Windows 98 and Windows ME, but just for Windows NT and higher.

The listeners themselves are only able to write into the Windows registry at installation and delete the writing at uninstall time.

To add registry support to an installation some changes in the installation definition file (install.xml) are to be made. First the declaration of the listener themselves:

<listeners>
	<listener classname="RegistryInstallerListener" stage="install" >
    	<os family="windows"/>
	</listener>
	<listener classname="RegistryUninstallerListener" stage="uninstall" >
		<os family="windows"/>
	</listener>
</listeners>


Now we need to add the native registry support to install.xml, see also Windows Registry Access:For cleanup purposes it is recommended to add the uninstaller listener to not leave :trash: entries in the registry after uninstalling a product.

<natives>
    <native type="3rdparty" name="COIOSHelper.dll" stage="both">
       <os family="windows"/>
    </native>
    <native type="3rdparty" name="COIOSHelper_x64.dll" stage="both">
       <os family="windows"/>
    </native>
</natives>

The DLL file should be placed in ${basedir}/bin/native/3rdparty. The stage both marks this dll not only to be put into the installation jar file but also to be put into the uninstaller jar file. This is automatically performed by the packager and installation.

With these two changes the registry support will be incorporated into your installation. Without any more actions an uninstall key will be crated in the registry at the installation. If you open the software manager of Windows, there will be an entry with the variables $APP_NAME $APP_VER, e.g.:

IzPack 4.6.8 (build 2007.02.15)

The variables will be defined from the entries <appname> and <appversion> in the <info> element of the installation definition file.

If you would like to have more informations in the uninstaller key or to create other keys or values in the registry, you should create a specification file. The file should be then refered to in install.xml as resource:

<resources>
    ...
    <res src="mySubPath/MyRegistrySpec.xml" id="RegistrySpec.xml"/>
</resources>

The id has to be RegistrySpec.xml.

See also CheckedHelloPanel for getting information on how to use those registry entries in an installer.Â