How to Create a Windows Installer for an SWT Application : Page 3
Native Windows installers offer unparalleled integration with the operating system, as well as familiar installation for users. Learn how to build a native Windows installer for an SWT application using open source tools.
by Stephen Strenn
Jan 17, 2006
Page 3 of 3
Step 4: Create Icons and Images
Now we need to create two icons (.ico) and a bitmap (.bmp). One icon is for display in the Windows Start Menu and one is for the installer application itself. The bitmap will be used to display a logo during installation:
Create an /images subdirectory under the project root.
Create an icon for the program and put it in the /images directory. Windows .ico files can contain multiple icons of different sizes (16x16, 32x32, and 48x48 are typical). If you do not have a tool that creates Windows .ico files directly, you can create .png files first, then merge them into an .ico file with png2ico.
Create an /installer subdirectory under the project.
Create a small (say 150x70) .bmp image for the application logo, and put it in the /installer directory.
Create or find a 16x16 .ico file for the installer executable and put it in the /installer directory. setup.ico, which is included with the downloadable samples for this article, is a standard Windows setup icon.
Step 5: Create an NSIS Installer Script
NSIS is an open-source tool for the development of professional-grade Windows installers. It sports standard features such as install, shortcut creation, and uninstall, as well as many advanced features such as custom dialogs, system reboots, and DLL/ActiveX control registration. A complete discussion of NSIS usage is beyond the scope of this article, so I will simply focus on what changes would need to be made to SimpleTextInstaller.nsi (see Listing 2) to get it to work for your own application:
is the instruction that creates the start menu launcher for the application. It assumes that the required JRE is already installed on the system.
In the Windows Explorer, right-click on your .nsi script, and select Compile NSIS Script. Assuming that there are no NSIS compile errors, this action should place a Windows installer in your /installer directory.
Be sure to test the installer on both the development machine and at least one end user machine. When installed and running, SimpleText appears as shown in Figure 4.
Stephen Strenn obtained his Master's Degree in Electrical Engineering from the University of California at Davis. He is a principal investigator at the Cogito Research Group and a consultant for the infrared detector industry. He has previously published in the areas of evolutionary computation, artificial intelligence, and robotics.