Creating Installer using IZPack
Posted By : Ashish Sharma | 24-May-2013
-Download and install IZPack from the given link (http://izpack.org/downloads/)
(Note: I have tried both the version 4.3.5 and 5.0.0, and 4.3.5 version seems more promising)
-create a separate folder which will contain all your files for the installation (i have created it in a D Drive with name myInstaller)
-copy the bin folder from the directory where you have installed your IZPack to you newly created directory.
-create a xml file with name "install.xml"
<?xml version="1.0" encoding="iso-8859-1" standalone="yes" ?> <installation version="1.0"> <info> <appname>Your AppName</appname> <appversion>1.0</appversion> <authors> <author name="Name" email="[email protected]"/> </authors> <url>ThisIsMyProject.com</url> </info> <guiprefs width="640" height="480" resizable="yes"/> <variables> <variable name="DesktopShortcutCheckboxEnabled" value="true"/> </variables> <locale> <langpack iso3="eng"/> </locale> <resources> <res src="shortcutSpec.xml" id="shortcutSpec.xml"/><!--This is used for creating shortcuts in desktop and program group--> <res id="LicencePanel.licence" src="License.txt"/> <res id="InfoPanel.info" src="Readme.txt"/> <res id="Installer.image.0" src="logo.png" /> </resources> <panels> <panel classname="HelloPanel"/> <panel classname="LicencePanel"/> <panel classname="TargetPanel"/> <panel classname="PacksPanel"/> <panel classname="InstallPanel"/> <panel classname="ShortcutPanel"/> <panel classname="FinishPanel"/> </panels> <dependency> <groupId>org.codehaus.izpack</groupId> <artifactId>izpack-standalone-compiler</artifactId> <version>4.3.5</version> </dependency> <packs> <pack name="Base" required="yes"> <description>Base Files</description> <file src="app.ico" targetdir="$INSTALL_PATH"/> <file src="MyProgram.exe" targetdir="$INSTALL_PATH"/> <file src="License.txt" targetdir="$INSTALL_PATH"/> <file src="Readme.txt" targetdir="$INSTALL_PATH"/> <fileset dir="myFolder" targetdir="$INSTALL_PATH/myFolder"> <include name="**"/> </fileset> </pack> <pack name="XYZServices" required="no"> <description>XYZServices files</description> <file src="someMoreFile.txt" targetdir="$INSTALL_PATH"/> </pack> </packs> <native type="izpack" name="ShellLink.dll"/> <native type="3rdparty" name="COIOSHelper.dll" stage="both"> <os family="windows"/> </native> </installation>
-create shortcutSpec.xml for creating shortcuts of your installed files
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <shortcuts> <skipIfNotSupported/> <programGroup defaultName="Tpsynergy Transform Client" location="applications"/> <shortcut name="My Application" programGroup="yes" desktop="yes" applications="yes" startMenu="yes" startup="no" target="$INSTALL_PATH\MyProgram.exe" commandLine="" description="My Application Description" iconFile="$INSTALL_PATH\app.ico" iconIndex="0" initialState="noShow" workingDirectory="$INSTALL_PATH"> <createForPack name="Base"/> </shortcut> <shortcut name="My App Uninstaller" programGroup="yes" desktop="no" applications="no" startMenu="no" startup="no" target="$INSTALL_PATH\Uninstaller\uninstaller.jar" commandLine="" iconFile="%SystemRoot%\system32\SHELL32.dll" iconIndex="31" description="Uninstall My Application"> <createForPack name="Base"/> </shortcut> </shortcuts>
-If you have runnable jar file of your project then you can use launch4j to create an exe of the jar file.
-Now to create the installer
1. first open the command prompt
2. go to the bin directory of IZPack installation directory
3. now run the following command "compile D:\myInstaller\install.xml -b D:\myInstaller"
-you will get an install.jar file in the "D:\myInstaller" directory, use it to install the application
Cookies are important to the proper functioning of a site. To improve your experience, we use cookies to remember log-in details and provide secure log-in, collect statistics to optimize site functionality, and deliver content tailored to your interests. Click Agree and Proceed to accept cookies and go directly to the site or click on View Cookie Settings to see detailed descriptions of the types of cookies and choose whether to accept certain cookies while on the site.
About Author
Ashish Sharma
Ashish is a bright Groovy and Grails developer and have worked on development of various SaaS applications using Grails technologies. Ashish likes PC games and works out at Gym in his free time.