Exercise 6.1 Building an Installer with the Advanced Designer

In this exercise we will rebuild the previous OfficeSuite Installer using the advanced designer. The advanced designer offers a much wider range of configuration over InstallAnywhere's many options than the Project Wizard allows.

1.
Creating a new project

a. Launch InstallAnywhere.

On the first screen, the Create New Project option should already be selected.

b. Select the Basic Project template.

This template should already be selected

c. Click Save As to save and name the project.

The Save New Project As dialog appears. InstallAnywhere will use this name as the name of the product in the installer project.

d. Select the Advanced Designer button.

This selection will open the newly created project file in the InstallAnywhere advanced designer. The advanced designer will open to the Project | Info task. This task sets the basic installer options such as the name of the product, the installer title, and the installer name. The installer name will be the name of the executable file that InstallAnywhere creates. This tab also sets the location for the building of the installer and the settings for the generation of installation logs.

e. Complete the Installer Title and Product Name fields.

For now, we will skip the Installer UI, Organization, and Files tasks.

2.
Pre-install actions

a. Select the Pre-Install task.

The Pre-Install task sets the panels and action that occur prior to the installation of files. By default, a new InstallAnywhere project contains the following panels.

Introduction: This panel allows developers to introduce the product or installation process.

Choose Install Folder: This panel allows the end-user to choose the installation location for the product.

Choose Alias, Link, Shortcut Folder: This panel allows the end-user to specify the location for any Mac OS aliases, Windows shortcuts, and UNIX symlinks (used as shortcuts) that will be installed.

Pre-Install Summary: This panel provides the end-user with a summary of various installation settings prior to the installation of files.

Actions in the Pre-Install task will occur in the order set in the task list. In a default project, an Introduction panel will be followed by a Choose Install Folder panel, followed by a Choose Alias, Link, Shortcut Folder panel, and so on. The order of panels and actions can be manipulated using the arrow buttons to the middle right of the advanced designer screen.

The behavior and content of panels can be modified by highlighting each panel. The dialog along the bottom half of the advanced designer will change to reflect the panel selected. In InstallAnywhere's vocabulary, this dialog is known as a customizer and is available for each action and panel in the installer.

3.
Defining the installation tasks

a. Select the Files task from the far left side of the advanced designer.

The Files task defines the files to install, the folder location in which to install those files, and the order in which the tasks need to happen as the files are being installed.

By default, the InstallAnywhere Files task has a folder called Uninstall $PRODUCT_NAME$, which contains any InstallAnywhere uninstaller actions and a Comment action with instructions pertaining to the uninstaller.

Actions (including, but not limited to, the installation of files) in the Files task list occur in order, with actions at the top of the installation occurring first.

HINT

The advanced designer implements a drag-and-drop interface in many tabs and tasks. In the Files task, actions and files can be moved by selecting and dragging them. A dark underline appears in the location where the file or action will be placed.

TIP

Leave the Uninstaller Creation in its default place in the installation (although the folder structure can be changed). For organizational purposes, it's generally best to have the Uninstaller Creation action first.

Because the advanced tutorial mainly replicates the tasks for the OfficeSuite installer from the Project Wizard, those same files will be added.

b. Add files.

  1. Use the File Chooser to browse to the OfficeSuite Source Files folder found in the InstallAnywhere installation directory. The folder can also be dragged and dropped into the Files task.

  2. Add the OfficeSuite 2000 folder and its contents.

    After they are added, the files will be displayed in the file installation tree in the advanced designer window.

    File trees may be expanded or contracted within the InstallAnywhere advanced designer Files task by clicking on the “+” or “–” boxes at the apex of the tree branches. An object may be moved up and down or into and out of subfolders in the file tree by highlighting the object and using the right, left, up, and down arrows (or dragging and dropping the files into the correct locations) found at the middle right of the Files task screen.

4.
Adding a LaunchAnywhere executable (LAX) to the Files task

a. Select the Add Launcher button.

An LAX is a unique native executable, created by InstallAnywhere, that is used to launch a Java application. While the InstallAnywhere wizard specifically asks you to select a main class and automatically creates a single launcher, the advanced designer allows developers to add as many launchers as they would like.

There are two ways to add a LaunchAnywhere launcher to an InstallAnywhere project file. The Create LaunchAnywhere for Java Application option may be selected from the Add Action palette or can be added by clicking the Add Launcher button on the middle control bar in the advanced designer.

  1. Highlight the User Install folder in the advanced designer and click the Add Launcher button.

  2. Click OK.

    When adding a launcher, InstallAnywhere will automatically introspect into the added files (including introspecting into Java archive [JAR] and or ZIP files) to find class files with main methods specified.

  3. Select com.acme.OfficeSuite as the main class for the application.

    Because OfficeSuite is a simple project, we're presented with only the com.acme.OfficeSuite class.

b. Click OK to continue.

NOTE

The Add Launcher button has not only added the launcher to the file structure, but also created a shortcut, link, or alias action in the Shortcuts' Destination Folder Magic Folder. This location is variable and will be specified by the Choose Alias, Link, and Shortcut panel in the pre-install section.

c. Customize the launcher.

The appearance the launcher will have as a shortcut can now be customized. Highlight the launcher. The customizer along the lower portion of the advanced designer screen will change to reflect the options for the Create LaunchAnywhere for Java Application action.

In the lower-middle right of the customizer (below the Arguments field) is a set of buttons that control the icon associated with the launcher. The default icons are a teal tile with a coffee cup and a rocket ship.

  1. Click Change to alter the icon.

  2. In the Choose Icon dialog, click Choose GIF File.

  3. Select a GIF or JPG file to use as an icon. For this tutorial, use the OfficeSuite Icon file in the Images and Docs folder within the OfficeSuite Source Files folder.

NOTE

Interlaced GIF files cannot be used with InstallAnywhere. The conversion process does not support these files, and their use can result in blank icons.

For Mac OS X, provide an ICNS file (created with iconbuilder—part of the Mac OS X Developer Tools).

d. Set the InstallAnywhere classpath.

InstallAnywhere maintains a general classpath that is used to create launchers for the Java application.

  1. In the InstallAnywhere advanced designer, click the Set Classpath button.

    A blue CP icon will appear on folders and archives that the process has added to the classpath.

  2. Select the Project | Java tab along the left side of the advanced designer window to view the classpath as determined by the Set Classpath action.

    Because OfficeSuite is a simple product, we'll have only the main OfficeSuite 2000 folder (which contains loose class files). If our example project contained JAR or ZIP files containing classes, they would also have been added. If a file has been added mistakenly on the classpath, it can be removed at this point or by highlighting that file in the installation tree and unchecking the In Classpath option box in the customizer for that file.

5.
Post-install actions

The Post-Install task list specifies actions and panels to occur after the installation of files. Like Pre-Install, the Post-Install step is ordered with the top actions occurring first.

By default, InstallAnywhere has added two actions to the InstallAnywhere project.

  • Panel: Install Complete. This panel appears when the installation has completed successfully. This action is determined by the status of the $INSTALL_SUCCESS$ variable. This panel will display only if $INSTALL_SUCCESS$ does not contain an error condition.

  • Restart Windows. This action restarts a Windows system if the installer determines that it is necessary.

InstallAnywhere installations are controlled primarily by InstallAnywhere rules. As an example of an InstallAnywhere rule, highlight the Restart Windows action in the OfficeSuite project. In the customizer in the lower portion of the screen, select the Rules tab.

The InstallAnywhere rules customizer will appear in the lower portion of the advanced designer. The rules set on the Restart Windows action are simple rules set to compare InstallAnywhere variables. InstallAnywhere rules are Boolean and allow the file, panel, or action to be installed, displayed, or run only if the rule resolves to true.

a. Click the Add Action button to open the action palette.

The action palette is divided by tabs that vary based on the task that is active at the time the palette is called.

b. Select Execute Target File found under the General tab.

The Execute Target File action is used to execute files that are included as part of the installation, and consequently it is available only in the install and post-install portion of the installation. (The Execute Target File action is not available at pre-install because files cannot be executed that are not installed yet!)

c. Click Add, or double-click on the action to add it.

The palette will remain open so additional actions may be added.

d. Add a name for the action in the customizer in the lower portion of the screen.

Naming the action will help identify it in the visual tree.

e. To select the target, click the Choose Target button.

The Choose an Action dialog represents the file installation tree specified in the Files task. File(s) can be executed in this stage. To execute the just-installed OfficeSuite application, choose the launcher for that application.

NOTE

Choose the actual OfficeSuite launcher, not the shortcut (which should share the same Icon). Shortcuts, especially on Windows and Mac OS systems, are pointers and are not inherently executable. InstallAnywhere will not execute a shortcut.


Customizer Options

By using the Command Line field modifications can be made to the command line used to execute the file, such as adding a handler or an argument to the execution.

NOTE

Do not remove or modify the $EXECUTE_FILE_TARGET$ entry, as this represents the file to execute. To specify a handler, prepend an executable path; to specify an argument, append a file path. These paths must be absolute; however, the paths can include InstallAnywhere variables.


The user experience for this action can be tailored by using the Options fields.

The option to suspend the installation until a process is complete is particularly useful in cases where a later step in the installation depends on the execution. There is also a subtask that allows developers to specify an indeterminate progress bar with a message. This task can be used if the execution may take some time (for example, an execute that installs another product or that configures a database or other application).

The Show Please Wait panel option will display a message panel to the user while the execution is occurring.

The Suppress First Window option allows developers to suppress the first window on Microsoft Windows platforms. This option is particularly useful in suppressing the appearance of the cmd.exe window when executing batch files or command-line executables.

NOTE

If the Execute Action panel was added at a location other than the bottom of the Post-Install task, move it now. Either utilize the up and down arrows, or drag the action to the bottom of the task list.


6.
Building the installer

The InstallAnywhere Build task allows the options that will be used to build the installer(s) to be set. In this task, you can set platforms for the build, configuration options for bundled virtual machines, and platform optimization and installer type.

TIP

For early testing, build only for the development platform. Each additional platform adds to the time required to build, cycling through run-rebuild-run-rebuild stages. A faster build will make the development process easier.

On the Build Targets tab in the Build task, select the platform(s). Selecting With VM will bundle the installer with a VM. With VM is only selectable for platforms that have a VM pack. VM packs should be placed in the <InstallAnywhere>/resource/installer_vms folder, and InstallAnywhere should be restarted to refresh the available VM packs.

The Build task also includes the Distribution and Build Log tabs.

The Distribution tab allows developers to set options for the type of installers to build and the optimizations for each installer. As the installer being built in this tutorial doesn't contain any platform-specific files, it will not need to be optimized at this point. However, if the installer did include platform-specific files, these files would be optimized based on the application of the Check Platform rules.

The Build Log tab displays the XML log of previous builds.

a. Click Build Project to build the OfficeSuite installer. The Build Information dialog will appear.

b. Click the blue arrow on the lower left of that dialog to see the build details console.

When the build is complete, there will be a notification (in this case, the build should take a minute or less).

7.
Testing

After the build process is complete, try the installer by selecting either the Try Web Install or Try Installer button. For the purposes of this exercise, use the Try Web Install button to launch our browser and the InstallAnywhere Web Install Page generated by the build process.

a. Click Try Web Install. The Web Install Page will load and should request a security access.

b. Grant this access to allow the Web Install Applet to run the InstallAnywhere installer.

The Web installer can now be launched with just one click.

c. Click the Start Installer for Windows button below the image. The applet will check for sufficient disk space, download the installer, and execute it.

d. Run the installer.

After the Install Complete panel, the installer should launch OfficeSuite. The OfficeSuite icon can now be selected from the Windows Start menu to run the installed product.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.225.57.126