Home arrow XML arrow Page 4 - Creating an XUL App Installer
XML

Creating an XUL App Installer


It is surprisingly easy to package and create an installer for a XUL application that you've written. Anyone who uses your application will thank you for it; it will save them a lot of time and effort. Keep reading to see how it's done.

Author Info:
By: Dan Wellman
Rating: 5 stars5 stars5 stars5 stars5 stars / 3
May 22, 2006
TABLE OF CONTENTS:
  1. · Creating an XUL App Installer
  2. · Getting Started
  3. · The Installation Process
  4. · Packaging Your Files

print this article
SEARCH DEVARTICLES

Creating an XUL App Installer - Packaging Your Files
(Page 4 of 4 )

To package your installation files into an XPI file, you can use standard archiving applications such the popular WinZip or WinRAR.  You simply need to select the option to create a new archive, select an appropriate name that ends with .XPI then set the Files of Type listbox to All Files.  Now choose the files to be packaged and hey presto! Your XPI archive should now exist. 

As you'll need to have a directory structure within the XPI file, I'd recommend using WinRAR as it is easier to create relative folder paths to set up the internal structure of the archive.  Ensure that you set the archive type to Zip however, and not RAR or it won't work; when you try to install it, you'll get an error message stating "Not a valid installation package."  Note that the JAR file inside the XPI archive must also be in ZIP format or the application won't work after the install. Once this has been done, your XPI package should appear like this:

 

The JAR file should contain folders for each element of the package, in this case, the content and locale directories:

 

Each of these folders should contain the relative paths to the application files:

 

Once your application is packaged, there is very little else that needs to be done; you just need to focus on deployment now, which is likely to be via a web page.  To run the XPI file, all you need to do is create a hyperlink to it; when the hyperlink is selected with a Mozilla browser, the installation process will begin:

Click the following link to install XULEditLite: <a href="xuleditlite.xpi">Install</a>

This is all you need.  Mozilla will handle the confirmation or error reporting, giving you either a success dialog when the installation is complete or an error message if things go wrong. The default, unconfigured messages don't provide much information however, so it is advisable to create your own alerts, such as one that informs the user that Mozilla will need to be restarted before the new application will be available.  It may also be wise to inform users that your application (if it is anything like this one) is best run stand-alone, and therefore, should perhaps also contain instructions on how to do this.

I like to run my XUL application as a stand-alone application in its own window, rather than within Mozilla itself.  Mozilla still powers my program; it just doesn't display anything on screen.  The only problem that I've found with this is that I have to open a command window and type out a command that will launch my application every time I want to use it.  One way that I've got around this is to create a batch file, which is pretty much just the same command to launch the program typed into a text file and saved with a .bat extension.  Linux users will know these files as shell scripts.

Add the following code to a text file and save it appropriately:

START mozilla -chrome chrome://interface/content

This will effectively create an executable that will launch your application without the need for manual intervention.  As part of the installation process, it would be relatively simple to assign this file to be installed to the desktop instead of the chrome directory to go that extra mile for the end user.

So you have seen how easy it is to package and create an installer for a XUL application that you have written. You'll find that knowing about packing makes things easier when creating skins as well, as downloadable skins for Mozilla or other XUL applications are also packaged in this way and installed using XPInstall. All in all, the various elements that make up the packaging and installation medium are an excellent way of going about things.  Everything is open source and relatively straight forward.


DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

blog comments powered by Disqus
XML ARTICLES

- Open XML Finally Supported by MS Office
- XML Features Added to Two Systems
- Using Regions with XSL Formatting Objects
- Using XSL Formatting Objects
- More Schematron Features
- Schematron Patterns and Validation
- Using Schematron
- Datatypes and More in RELAX NG
- Providing Options in RELAX NG
- An Introduction to RELAX NG
- Path, Predicates, and XQuery
- Using Predicates with XQuery
- Navigating Input Documents Using Paths
- XML Basics
- Introduction to XPath

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials