install4j API

com.install4j.api.launcher
Class ApplicationLauncher

java.lang.Object
  extended by com.install4j.api.launcher.ApplicationLauncher

public class ApplicationLauncher
extends java.lang.Object

This class allows you to launch an installer application, such as an updater, from your own application. It includes a mechanism for the installer application to shut down the invoking application with a "Shutdown calling launcher" action.

In order to use this class, please include resource/i4jruntime.jar from your install4j installation into your class path. You do not need to distribute this file along with your application, install4j will do this automatically for you.

Author:
ej-technologies GmbH

Nested Class Summary
static interface ApplicationLauncher.Callback
          You can implement this interface to receive notifications when the installer application exits or needs to shut down your application.
static class ApplicationLauncher.WindowMode
          Window mode for starting the application in process.
 
Constructor Summary
ApplicationLauncher()
           
 
Method Summary
static void launchApplication(java.lang.String applicationId, java.lang.String[] arguments, boolean blocking, ApplicationLauncher.Callback callback)
          Launch an installer application that you have defined in the install4j IDE.
static void launchApplicationInProcess(java.lang.String applicationId, java.lang.String[] arguments, ApplicationLauncher.Callback callback, ApplicationLauncher.WindowMode windowMode, java.awt.Window parentWindow)
          Launch an installer application that you have defined in the install4j IDE.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ApplicationLauncher

public ApplicationLauncher()
Method Detail

launchApplication

public static void launchApplication(java.lang.String applicationId,
                                     java.lang.String[] arguments,
                                     boolean blocking,
                                     ApplicationLauncher.Callback callback)
                              throws java.io.IOException
Launch an installer application that you have defined in the install4j IDE. The application is launched in a new JVM.

Parameters:
applicationId - the ID of the installer application to be launched. You can show the IDs of all installer applications on the "Installer->Screens & actions" tab with the "Show IDs" tool bar button.
arguments - the arguments you want to pass to the installer application. Can be null if no arguments should be passed. Arguments like -Dkey=value will be passed as JVM parameters, just like when calling the installer application from the command line.
blocking - if this call should block until the installer application exits.
callback - an optional call back for receiving notifications when the installer application exits or when the installer application shuts down this JVM. Can be null
Throws:
java.io.IOException - if there was an error starting the installer application

launchApplicationInProcess

public static void launchApplicationInProcess(java.lang.String applicationId,
                                              java.lang.String[] arguments,
                                              ApplicationLauncher.Callback callback,
                                              ApplicationLauncher.WindowMode windowMode,
                                              java.awt.Window parentWindow)
Launch an installer application that you have defined in the install4j IDE. The application is launched in the same process. The look and feel as well as the locale is not changed. This call will return immediately if you call it from the event dispatch thread (EDT), otherwise it will block until the installer application exits.

The "Shutdown calling launcher" action has a different effect than usual: The whole process will be terminated when the installer application exits. Furthermore, the "Request privileges" action only works for elevating a helper process, not the main process.

Parameters:
applicationId - the ID of the installer application to be launched. You can show the IDs of all installer applications on the "Installer->Screens & actions" tab with the "Show IDs" tool bar button.
arguments - the arguments you want to pass to the installer application. Can be null if no arguments should be passed. Arguments like -Dkey=value will be passed as JVM parameters, just like when calling the installer application from the command line.
callback - an optional call back for receiving notifications when the installer application exits or when the installer application shuts down this JVM. Can be null
windowMode - if the wizard should be shown in a dialog or in a frame
parentWindow - the parent window if the wizard should be shown in a dialog. Can be null.

install4j API