Wednesday, February 28, 2007

Creating a multiplatform installer (with IzPack)

Hello once again.
As promised, today I'll talk about how to create your multiplatform installer for your Eclipse Rich Client Application without having to add all the folders PDE (Plugin Development Environment) created.

First of all, understand that what I'll explain for IzPack can be used for any other installer you like. Just search for a feature similar to the one I quote in your installer and you should have no problem.
Now that this is explained, let's get started:
First of all, part of your jobs is already done thanks to the eRCP imposed architecture. I'm talking about having your project split in several parts that are almost completly independent. This is very useful since it'll allow your user to choose the plugins he wishes to install.
This reminds me of something: feature != plugins.
Your update site or your product uses a set of plugins and call it a feature if you followed most of the tutorials. This doesn't means your installer must care about your feature definitions.
The feature definition will allow your update system to know which updates it should look for and which features are considered "new features". This means that if your application is running without any feature and you ask for an update, it'll show you the core feature (which you obviously already have since you're running your application) as a "new feature" to be installed. That can be explained by the fact that sites only know about features and never look to plugins.

Therefore, a good practice is to have your core feature as a required package in your installer. Any other feature you would like the user to update through the update system should also be joined as a package in your installer. However, if you wish to offer the user the choice to install only one plugin regardless what is its feature, you can do it without further consequences. Your application will work without a problem and with this plugin activated.

So, you have decided what will be the packages available in your installer. You must know what license you'll use and you can have a couple shortcuts because it's always useful.

Now let's produce the XML file that will explain to IzPack how it should work.
Your first section of the IzPack XML should be the something like:

<info>
<appname>Your App</appname>
<appversion>@{version}</appversion>
<authors>
<author name="Tarantulus Corp." email="archimedesproject@googlegroups.com" />
</authors>
<url>http://www.archimedes.org.br/</url>
<webdir>http://arquimedes.sf.net/update</webdir>
</info>


No big secret on that. It defines mainly the first screen post language choose. Excepting 'webdir' all those fields are shown in that screen. The 'webdir' is the addressed used to search for the package if you are about to create an online installer. This is mainly the only thing that changes from a local installer to an online installer in IzPack.
The second part of your XML should be:

<guiprefs width="640" height="480" resizable="no">
<modifier key="useButtonIcons" value="yes" />
<modifier key="useLabelIcons" value="yes" />
<modifier key="langDisplayType" value="native" />
<modifier key="headingPanelCounter" value="progressbar" />
<modifier key="headingPanelCounterPos" value="inNavigationPanel" />
</guiprefs>

This is a bit more obscure. The first lines are quite easy to understand. 'landDisplayType' is not that easy however. It sets how the installer will show the options of language to the user on the first screen of your installer. In this case, native tells the software to use the system's locale to write the languages. 'headingPanelCounter' and 'headingPanelCounterPos' defines how the steps remaining and the current step should be shown to the user. If those lines are not present, nothing will be displayed.

Next you have:

<resources>
<res id="installer.langsel.img" src="installer.png" />
<res id="LicencePanel.licence" src="license.txt" />
<res id="shortcutSpec.xml" src="shortcutSpec.xml" />
<res id="packsLang.xml_eng" src="packsLang_eng.xml" />
</resources>


Okay. Now we're talking! First of all, the image to be shown in the first screen of the installer is the one on the first line. The license that will be displayed to the user and that he will be forced to accept unless it quites the install. Beware, this license should be in a text format because IzPack will display it as a text only file. The last lines regard the shortcut creation and the internationalization of this installer. Take a look on the official documentation and this should be enough.

The next part is what will define the flow of your IzPack installer:

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

Those panels are available by default in IzPack. You can, however, create your own panels as well as install new ones created by the community and available mainly at IzPack's site (http://www.izforge.com/izpack).

At last, the last part is the most important one. The one that will specify each pack of your application:

<packs>
<pack name="Core" id="core" required="yes">
<description>The core of Your App.</description>
<fileset dir="@{deployDir}/win32.win32.x86/YourAppName/" targetdir="$INSTALL_PATH">
<include name="startup.jar" />
<include name="configuration/config.ini" />
<include name="features/org.eclipse.rcp*/**/*" />
<include name="features/your.company.project.feature*/**/*" />
<include name="plugins/**/*" />
<exclude name="plugins/your.company.project.*.jar" />
<exclude name="plugins/org.eclipse.swt.*linux*.jar" />
<exclude name="plugins/org.eclipse.opengl.linux*/*" />
<exclude name="plugins/org.eclipse.opengl.linux*/**/*" />
</fileset>

<fileset dir="@{deployDir}/linux.gtk.x86/YourAppName/" targetdir="$INSTALL_PATH">
<include name="icon.xpm" />
<include name="yourapp" />
<include name="about.html" />
<include name="libcairo-swt.so" />
<include name="about_files/**/*" />
<include name="plugins/org.eclipse.swt.*linux*.jar" />
<include name="plugins/org.eclipse.opengl.linux*/**/*" />
<os name="linux" />
</fileset>
<fileset dir="@{deployDir}/macosx.carbon.ppc/YourAppName/" targetdir="$INSTALL_PATH">
<include name="yourapp.app/**/*" />
<include name="plugins/org.eclipse.swt.*macos*.jar" />
<include name="plugins/org.eclipse.opengl.macos*/**/*" />
<os family="osx" />
</fileset>
<fileset dir="@{deployDir}/win32.win32.x86/YourAppName/" targetdir="$INSTALL_PATH">
<include name="yourapp.exe" />
<include name="plugins/org.eclipse.swt.*win32*.jar" />
<include name="plugins/org.eclipse.opengl.win32*/**/*" />
<os family="windows" />
</fileset>

<!-- The windows scripts -->
<executable targetfile="$INSTALL_PATH/yourapp.exe" stage="never">
<os family="windows" />
</executable>

<!-- The Linux scripts -->
<executable targetfile="$INSTALL_PATH/yourapp" stage="never">
<os name="linux" />
</executable>
</pack>
</packs>


Each <pack> must have one or more files registered. Those can be added using the file tag (when you want to work with one specific file) or the fileset tag (when you want to work with folders) as shown. The fileset accepts both <include> and <exclude> tags which allows you to easily create exceptions in your folders. Also, all those tags accept <os> that will be interepreted as a mark to tell the installer on which OSs those files should be unpacked. This is mainly how you separate things. The first fileset defined in the example above is the one that grabs all non-OS specific files from the RCP. The next 3 filesets are used to select os specific files as the 'os' tag shows.

At last, the <executable> tag marks the file you target as executable. This means a double click or a command will try to run those files. This is required because the installer will zip all the files in jars and loose all kind of permissions over the file on install. So it needs to know which files should be diferent from the read and write permissions.

All this should allow you to create a simple multi platform installer for your eRCP application. Once this is done, you'll probably want to add the <locale> tag to add internationalization support to your installer and then you'll need to create some language specific XML with pack descriptions translations and everything else.

A last tip, beware to export all of your features and plugins when you are in Eclipse. You'll need all the files available on your deployDir to make the installer work well.

The next post will discuss about how to create all the application, the installer and transfer all to a website using one simple script. This allows a much quicker and constant deploy of your software to your users. Expect it done for saturday or sunday.

See you guys soon. Bye bye.

28 comments:

Kiril said...

Cool, but where is shortcutSpec.xml?

Hugo "NighT" Corbucci said...

My mistake.
Sorry. All the files are available at:
https://incubadora.fapesp.br:8043/svn/archimedes/br.org.archimedes.izpack/

But here follows the shortcutSpec.xml:

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>

<shortcuts>

<skipIfNotSupported />

<programGroup defaultName="Tarantulus\Archimedes"
location="applications||startMenu" />

<shortcut name="Archimedes" programGroup="yes" desktop="yes"
applications="no" startMenu="no" startup="no"
target="$INSTALL_PATH\Archimedes.exe" workingDirectory="$INSTALL_PATH"
commandLine="" description="Starts Archimedes"
initialState="noShow">

<createForPack name="Core" />
</shortcut>

<shortcut name="Uninstaller" programGroup="yes" desktop="no"
applications="no" startMenu="no" startup="no"
target="$JAVA_HOME/bin/java.exe" workingDirectory="$INSTALL_PATH\Uninstaller\"
commandLine="-jar uninstaller.jar"
iconFile="%SystemRoot%\system32\SHELL32.dll" iconIndex="31"
description="Uninstalls Archimedes">

<createForPack name="Core" />
</shortcut>

</shortcuts>

And here is the unix version:

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>

<shortcuts>
<programGroup defaultName="Archimedes"
location="applications" />
<shortcut name="Archimedes" programGroup="yes" desktop="yes"
applications="no" startMenu="yes" startup="no"
target="$INSTALL_PATH/Archimedes" iconFile="$INSTALL_PATH/icon.xpm"
iconIndex="0" workingDirectory="$INSTALL_PATH/"
description="Starts Archimedes" type="Application" encoding="UTF-8"
terminal="false" KdeSubstUID="false" initialState="normal"
categories="" createForAll="true">
<createForPack name="Core" />
</shortcut>

<shortcut name="Archimedes Uninstaller" programGroup="yes"
desktop="no" applications="no" startMenu="yes" startup="no"
target="$JAVA_HOME/bin/java"
commandLine="-jar uninstaller.jar"
iconFile="trashcan_empty" iconIndex="0"
workingDirectory="$INSTALL_PATH/Uninstaller/" description="Starts Archimedes"
type="Application" encoding="UTF-8" terminal="false"
KdeSubstUID="false" initialState="normal" categories=""
createForAll="true">
<createForPack name="Core" />
</shortcut>
</shortcuts>

AlfaOmega83 said...

Hi,First of all tnx for the good guide.unfortunately the link to incubadora doesn't work(access denied)....where i can find the .xml code?

Hugo Corbucci said...

The incubadora is letting me down for a while now.
I migrated all the files to a new SVN server (http://svn.archimedes.org.br/public/). The files for this post should be available at: http://svn.archimedes.org.br/public/mainarchimedes/rcparchimedes/br.org.archimedes.izpack/trunk/

Please warn me if you find any problem.

Anonymous said...

Good Afternoon

Thanks for sharing, I have digged this post

Anonymous said...

She gets over-whelmed emotionally and cutting, shes explained to me (and only me) helps her calm down and helps her nerves.. [url=http://www.vanessasac.com]boutiques vanessa bruno [/url] vanessa bruno
[url=http://www.canadagoosessoldeparis.fr]doudou canada goose[/url] His analysis has been an eye opener to his clients which leads to extensive changes in the way they do business..
[url=http://www.thomassabojewellerystore.co.uk]thomas sabo bracelets[/url] mirielle. [url=http://www.pandorajeweluk.co.uk]pandora outlet[/url]

Anonymous said...

top [url=http://www.001casino.com/]casino online[/url] brake the latest [url=http://www.casinolasvegass.com/]free casino[/url] manumitted no set aside bonus at the foremost [url=http://www.baywatchcasino.com/]baywatch casino
[/url].

Anonymous said...

[url=http://loveepicentre.com/faq.php][img]http://loveepicentre.com/uploades/photos/10.jpg[/img][/url]
dating cameo jewelry [url=http://loveepicentre.com/articles.php]interracial info about dating asians[/url] dating business services
blackplanet dating [url=http://loveepicentre.com/articles.php]trinidad colorado dating singles[/url] panama panama dating
advice dating friend [url=http://loveepicentre.com/faq.php]seattle dating sites[/url] dating email me girlfirend

Anonymous said...

[url=http://loveepicentre.com][img]http://loveepicentre.com/uploades/photos/8.jpg[/img][/url]
adult hebrew online dating [url=http://loveepicentre.com]dennis quaid dating[/url] dating women who are too shy
over 40 dating sites [url=http://loveepicentre.com/testimonials.php]dating on myspace[/url] adult chat dating free services
blush dating [url=http://loveepicentre.com/]dating for ugly people[/url] messianic jewish dating websites

Anonymous said...

dating and 50 in atlanta http://loveepicentre.com/success_stories.php dating arabic guys

Anonymous said...

cheesemaking ebook torrent http://audiobookscollection.co.uk/Islamic-Biomedical-Ethics-Principles-and-Application/p162459/ ebook self help [url=http://audiobookscollection.co.uk/fr/Judy-Tatelbaum/m67833/]what format is ebook[/url] the minor fonvizin ebook

Anonymous said...

ebook wholesale uk http://audiobookscollection.co.uk/Practice-and-Theory-of-Automated-Timetabling-V-5th-International-Conference-PATAT-2004-Pittsburgh-PA-USA-August-18-20-2004-Revised-Selected-Computer-Science-and-General-Issues/p209618/ sport in society jay coakley ebook [url=http://audiobookscollection.co.uk/The-Regal-Theater-and-Black-Culture/p225096/]sony online ebook store[/url] ebook cloud google

Anonymous said...

ebook lending library http://audiobooksworld.co.uk/it/Assignment-in-Eternity/p30157/ soldering circut board repair ebook [url=http://audiobooksworld.co.uk/es/Acci-n-Aventura/c101/?page=1]free ebook downloadable sites[/url] seeing through statistics ebook

Anonymous said...

the thirst no 1 free ebook http://audiobooksworld.co.uk/Ubiquitous-Intelligence-and-Computing-Third-International-Conference-UIC-2006-Wuhan-China-September-3-6-2006-Proceedings-Lecture-Notes-in-Applications-incl-Internet-Web-and-HCI/p209877/ forex trading ebook 2008 [url=http://audiobooksworld.co.uk/Pro-Visual-C-CLI-and-the-NET-2-0-Platform-Expert-s-Voice-in-NET/p204680/]game of cages ebook[/url] game programming ebook 20
[url=http://audiobooksworld.co.uk/Harper-Connelly-Series/p21619/][img]http://audiobooksworld.co.uk/image/4.gif[/img][/url]

Anonymous said...

Hello. And Bye. Thank you very much.

Anonymous said...

Hello. And Bye. Thank you very much.

Anonymous said...

garmin full mapsource software http://buyoemsoftware.co.uk/es/product-36590/Microsoft-Windows-7-Ultimate-x64-Italy overature music notation software [url=http://buyoemsoftware.co.uk/product-36428/Benthic-Software-Golden-6-6-0]computer software stores companies place[/url] medical recognition software speech voice
[url=http://buyoemsoftware.co.uk/product-14306/BBEdit-8-6-Mac]BBEdit 8.6 [Mac] - Cheap Legal OEM Software, Software Sale, Download OEM[/url] systeme software
[url=http://buyoemsoftware.co.uk/es/product-23274/Adobe-Flash-Pro-CS4-Mac][img]http://buyoem.co.uk/image/1.gif[/img][/url]

Anonymous said...

blockbuster software http://buysoftwareonline.co.uk/es/newslist sign language software download [url=http://buysoftwareonline.co.uk/fr/product-13180/Macromedia-JRun-4]bluezone software serialz[/url] computer telephony software solution india
[url=http://buysoftwareonline.co.uk/product-37373/Active-System-Locker-3-2]Active System Locker 3.2 - Software Store[/url] slyvania mp3 player smpk2062 software download
[url=http://buysoftwareonline.co.uk/es/product-14239/Synchronize-Pro-X-5-0-Mac][img]http://buyoem.co.uk/image/4.gif[/img][/url]

Anonymous said...

We [url=http://www.realcazinoz.com]craps[/url] be subjected to a rotund library of totally unsolicited casino games for you to sport privilege here in your browser. Whether you appetite to procedure a provender round master plan or even-handed sample manifest a some new slots once playing seeking unfeigned filthy lucre, we be undergoing you covered. These are the claim uniform games that you can play at real online casinos and you can play them all quest of free.

Anonymous said...

[url=http://onlinemedistore.com/products/seroquel.htm][img]http://onlinemedistore.com/4.jpg[/img][/url]
discount pet meds medicine pharmacy http://onlinemedistore.com/catalogue/d.htm cvs pharmacy tucson [url=http://onlinemedistore.com/products/prazosin.htm]indian pharmacy generic cialis[/url]
pharmacy sale of reductil pills in london http://onlinemedistore.com/products/evista.htm drake pharmacy [url=http://onlinemedistore.com/products/amoxil.htm]amoxil[/url]
the natural pharmacy http://onlinemedistore.com/products/ed-discount-pack-1.htm online courses for pharmacy [url=http://onlinemedistore.com/products/parlodel.htm]canadian holanda pharmacy[/url]
tarceva florida pharmacy http://onlinemedistore.com/products/zofran.htm putnam pharmacy eau claire [url=http://onlinemedistore.com/products/cok-n--energy-and-sensory-enhancer-.htm]cok n energy and sensory enhancer [/url]

Anonymous said...

Have you ever considered publishing an ebook or guest authoring on other websites?
I have a blog centered on the same ideas you discuss and would love to have you share some stories/information.
I know my viewers would value your work. If you're even remotely interested, feel free to shoot me an e-mail.

Here is my blog post ... face book of sex

Anonymous said...

Thanks for the tips you have discussed here. Yet another thing I
would like to mention is that laptop or computer memory requirements generally go up along with other developments in the technological innovation.
For instance, whenever new generations of processors are introduced to the market, there is
usually a related increase in the dimensions
pr of both the computer system memory and also hard
drive space. This is because the program operated
through these processor chips will inevitably increase in power to make
use of the new technological know-how.

Also visit my weblog ... facebook for sex

Anonymous said...

You completed several nice points there. I did a search on the
topic and found most persons will agree with your
blog.

Review my blog post: facebook of sex

Anonymous said...

http://www.maps.google.com/ - [url=http://www.wikipedia.org/]wiki[/url]
mail

Anonymous said...

Fοr most up-to-date infоrmаtіon yоu haνe to pay а quіck
viѕit intегnet and on ωorld-ωіԁe-web ӏ
found thіs site as а moѕt еxcellеnt ωeb sitе fοr newest updateѕ.


Mу blog poѕt :: Link Building Service

Anonymous said...

free adult online dating services http://loveepicentre.com/success_stories/ dinnre dating brighton
pittsburgh dating online [url=http://loveepicentre.com/success_stories/]julia slusar dating[/url] new uk dating sites
southern il dating services [url=http://loveepicentre.com/map/]personals dating site in the world[/url] b w photo paper dating kodak [url=http://loveepicentre.com/user/SUCCESSLOVE/]SUCCESSLOVE[/url] other fish dating site

Anonymous said...

Hmm it seems like your website ate my first comment (it was super long)
so I guess I'll just sum it up what I had written and say, I'm thoroughly enjoying your
blog. I too am an aspiring blog blogger but I'm still new to everything.
Do you have any helpful hints for novice blog writers?
I'd genuinely appreciate it.

Here is my web-site :: facebook/sex

Prologic Corporation said...

This is a good article & good site.Thank you for sharing this article. It is help us following categorize:
healthcare, e commerce, programming, it consulting, retail, manufacturing, CRM, digital supply chain management, Delivering high-quality service for your business applications,
Solutions for all Industries,
Getting your applications talking is the key to better business processes,
Rapid web services solutions for real business problems,
Web-based Corporate Document Management System,
Outsourcing Solution,
Financial and Operations Business Intelligence Solution,

Our address:
2002 Timberloch Place, Suite 200
The Woodlands, TX 7738

prologic-corp