Overview | Package | Class | Tree | Deprecated | Index | Help
| install4j API
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.install4j.api
Class StartupHandler

    java.lang.Object
      com.install4j.api.StartupHandler

    public class StartupHandler

extends java.lang.Object

If you define a startup handler derived from this class on the "Advanced tasks" tab in the install4j GUI it will be instantiated and queried before the installer and the uninstaller is started. The purpose of this handler is to be able to check the environment and abort the installation before any action is taken or the installer or uninstaller is displayed. Additionally, you can use this handler to shutdown running processes.

Author:
  ej-technologies GmbH

Constructor Summary
`StartupHandler()`

Method Summary
`java.io.File` | `getDefaultInstallationDirectory()` This method will be called if `prepareInstaller` returns true to determine if a different installation directory should be suggested in the installation location screen.
`boolean` | `prepareInstaller(InstallerContext context)` This method will be called before the installer is started.
`boolean` | `prepareUninstaller(Context context)` This method will be called before the uninstaller is started.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### StartupHandler

    public StartupHandler()

Method Detail

### prepareInstaller

    public boolean prepareInstaller(InstallerContext context)

  This method will be called before the installer is started. Return `true` to continue the installation or `false` to abort the installation. Note: When aborting with `false`, no further error message is displayed. You have to display any error or warning messages in the body of this method. For unattended installers, you should print something on the terminal or use `System.exit()` to return an error code if the installer should not run. Returns `true` by default.

  Parameters:
    `context` - the installation context.
  Returns:
    whether the installation should be continued.

### prepareUninstaller

    public boolean prepareUninstaller(Context context)

  This method will be called before the uninstaller is started. Return `true` to continue the uninstallation or `false` to abort the uninstallation. Note: When aborting with `false`, no further error message is displayed. You have to display any error or warning messages in the body of this method. For unattended uninstallers, you should print something on the terminal or use `System.exit()` to return an error code if the uninstaller should not run. Returns `true` by default.

  Parameters:
    `context` - the uninstallation context.
  Returns:
    whether the uninstallation should be continued.

### getDefaultInstallationDirectory

    public java.io.File getDefaultInstallationDirectory()

  This method will be called if `prepareInstaller` returns true to determine if a different installation directory should be suggested in the installation location screen. If you return `null`, the standard build-time value will be used. Returns `null` by default.

  Returns:
    the default installation directory or `null`

Overview | Package | Class | Tree | Deprecated | Index | Help
| install4j API
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD