## install4j API documentation

## com.install4j.api
Class Util

    java.lang.Object
      com.install4j.api.Util

    public class Util

extends java.lang.Object

The class contains various utility functions to be used by custom actions and custom screens.

Author:
  ej-technologies GmbH

Constructor Summary
`Util()`

Method Summary
`static void` | `fatalError(java.lang.Throwable t)` This method can be invoked if you encounter a non-recoverable and non-expected error in your custom code.
`static java.lang.String` | `getInstallerLanguage()` Return the language of the installer.
`static java.awt.Window` | `getParentWindow()` Get the window of the installer.
`static java.lang.String` | `getStandardApplicationsDirectory()` Returns the standard directory for installing applications.
`static boolean` | `isHpux()` Returns whether the platform is HP UX.
`static boolean` | `isLinux()` Returns whether the platform is Linux.
`static boolean` | `isMacOS()` Returns whether the platform is Mac OS X.
`static boolean` | `isSolaris()` Returns whether the platform is Solaris.
`static boolean` | `isWindows()` Returns whether the platform is Windows.
`static boolean` | `isWindows9X()` Returns whether the platform is Windows 9X (95, 98, ME).
`static boolean` | `isWindowsNT()` Returns whether the platform is Windows NT (not Windows 2000 and XP).
`static void` | `showMessage(java.lang.String message, int messageType)` Show a message dialog.
`static int` | `showOptionDialog(java.lang.String message, java.lang.String[] options, int messageType)` Show an options dialog.
`static void` | `showUrl(java.net.URL url)` Show a URL in the default browser.

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

Constructor Detail

### Util

    public Util()

Method Detail

### getInstallerLanguage

    public static java.lang.String getInstallerLanguage()

  Return the language of the installer. This corresponds to the setting in the media file wizard.

  Returns:
    the language ISO code (like "en" or "de")

### isSolaris

    public static boolean isSolaris()

  Returns whether the platform is Solaris.

  Returns:
    the result

### isLinux

    public static boolean isLinux()

  Returns whether the platform is Linux.

  Returns:
    the result

### isWindows

    public static boolean isWindows()

  Returns whether the platform is Windows.

  Returns:
    the result

### isWindows9X

    public static boolean isWindows9X()

  Returns whether the platform is Windows 9X (95, 98, ME).

  Returns:
    the result

### isWindowsNT

    public static boolean isWindowsNT()

  Returns whether the platform is Windows NT (not Windows 2000 and XP).

  Returns:
    the result

### isMacOS

    public static boolean isMacOS()

  Returns whether the platform is Mac OS X.

  Returns:
    the result

### isHpux

    public static boolean isHpux()

  Returns whether the platform is HP UX.

  Returns:
    the result

### getStandardApplicationsDirectory

    public static java.lang.String getStandardApplicationsDirectory()

  Returns the standard directory for installing applications.

  Returns:
    the directory

### showUrl

    public static void showUrl(java.net.URL url)

  Show a URL in the default browser. If no default browser can be determined for the operating system, the user is asked to locate the executable of the internet browser. This executable is cached so that subsequent invocations of this method do not bring up this questions again.

  For quiet installers, this method does nothing.

  Parameters:
    `url` - the URL to be shown in the browser.

### showMessage

    public static void showMessage(java.lang.String message,
                                   int messageType)

  Show a message dialog. This message dialog is a JOptionPane, the parameters are equivalent to those of the standard Java class.

  Parameters:
    `message` - the message
    `messageType` - the message type (see JOptionPane)
  See Also:
    `JOptionPane`

### showOptionDialog

    public static int showOptionDialog(java.lang.String message,
                                       java.lang.String[] options,
                                       int messageType)

  Show an options dialog. This option dialog is a JOptionPane, the parameters are equivalent to those of the standard Java class

  Parameters:
    `message` - the message
    `options` - the options
    `messageType` - the message type (see JOptionPane)
  Returns:
    the index of the selected option or -1 if the installer is silent
  See Also:
    `JOptionPane`

### fatalError

    public static void fatalError(java.lang.Throwable t)

  This method can be invoked if you encounter a non-recoverable and non-expected error in your custom code. The exception and all system properties will be printed to a log file and the user will be informed with a crash dialog. The installer will then quit.

  Parameters:
    `t` - the exception that ocurred

### getParentWindow

    public static java.awt.Window getParentWindow()

  Get the window of the installer.

  Returns:
    the window or `null` if the installer is silent