Thursday, July 12, 2007

Basic Installer this IzPack

IzPack is a very easy for you to contribute, is a tool that will help you to solve you software installation problems. First of all, you need to download the IzPack http://www.izpack.org
IzPack uses XML files to describe installations. So there are no UI interface and your must write the XML installation file ”by hand” and compiling it with the command line compiler or invoking the compiler as the Ant task.
A specially I use Ant script to build my application. You need write only one time Ant script and call it.
build.xml
<project name="My Application Installer" default="installer" basedir=".">
 <property name="dist.dir" value="."/>
 <!-- Allows us to use the IzPack Ant task ( i use stand alone compilation )-->
   <taskdef name="izpack" classpath="../izpack/standalone-compiler.jar" classname="com.izforge.izpack.ant.IzPackTask"/>
 <target name="installer">
     <echo message="Makes the Installer using IzPack"/>
     <izpack input="${dist.dir}/installer.xml" output="${dist.dir}/installer.jar" installertype="standard" basedir="${dist.dir}" izpackdir="${dist.dir}/">
 </target>
</project>
Now is the time to think about writing XML. As written in Ant script our XML is called as installer.xml. All IzPack XML start with a tag <installation> where is the following tags:
  • info - information about application;
  • variables - to specify variables of installation;
  • guiprefs - GUI preferences (here you can set layout style, installation windows size ...);
  • locale - to specify the language packs that you want to use for your installer;
  • resources - most panels have resources, here you can specify you resources for panels;
  • panels - IzPake have predefined panels that help as create installation easy and fast;
  • packs - here you can specify package, most common you have one or two packages;

installer.xml
<!--     Application installation file.       To compile it :     - go in call with ant build.xml file.    -->
<installation version="1.0">
   <!--         The info section.           -->
   <info>
       <appname>My application</appname>
       <appversion>1.0</appversion>
       <authors>
           <author name="developer" email="info@developer.com">
       </authors>
       <url>http://www.home.page</url>
       <javaverison>1.6</javaverison>
   </info>
   <guiprefs width="800" height="600" resizable="no">
       <laf name="looks">
           <os family="windows"/>
       </laf>
   </guiprefs>
   <locale>
       <langpack iso3="eng"/>
   </locale>
   <resources>
       <res id="LicencePanel.licence" src="Licence.txt"/>
       <res id="InfoPanel.info" src="Readme.txt"/>
   </resources>
   <panels>
       <panel classname="HelloPanel"/>
       <panel classname="InfoPanel"/>
       <panel classname="LicencePanel"/>
       <panel classname="TargetPanel"/>
       <panel classname="InstallPanel"/>
       <panel classname="FinishPanel"/>
   </panels>
   <packs>
       <pack name="Core" required="yes">
           <description>Core package</description>
           <fileset dir="../dist/Application/" targetdir="$INSTALL_PATH">
               <include name="**/*"/>
           </fileset>          
       </pack>
   </packs>
</installation>
Installation have wizard with a six panels. First show the application info, second show detail info
which is taken from Readme.txt, third is showing license  from License.txt, fourth  suggest  select application directory,  fifth install application, and at finish installation succeed.
Now you can show you application to the world. Remember 28% of application have crash on installation process.

Wednesday, July 11, 2007

Java Web Start application uninstall

Today I start implement in my Java Web Start application the installer-desc element to identify and installer/uninstaller for an application. Which must be declared in main JNLP file as extension and in installation JNLP have . For installation and uninstalling, the JNLP Client must invoke the public static void main(String[]) method in the specified class with the String array {"install" | "uninstall"} as an argument. The end user should has suitable a Java version 7(b13), 6u2(b01) to call the uninstaller.