# StartupNotification

Import: `import com.install4j.api.launcher.StartupNotification;`

```java
public class StartupNotification
```

This class allows you to register a listener to receive startup
events in single instance mode on Microsoft Windows and
file open events on macOS.

On macOS, this is a facade for the platform-specific Java extensions.
If you want to use additional features, please use the com.apple.eawt
classes directly that are available in all pre-Java 9 macOS JREs or
the new Java 9 java.awt.desktop functionality.

| Type | Kind | Description |
|---|---|---|
## Nested types

| [StartupNotification.Listener](StartupNotification.Listener.md) | interface | The interface for startup events in single instance mode or for open file events on macOS. |

## Methods

| Signature | Returns | Description |
|---|---|---|
| [`registerStartupListener(Listener)`](#registerstartuplistener-listener) | `void` | Register a listener to receive startup events in single instance mode on Microsoft Windows or to receive file open events on macOS. |
| [`setHandleQuit(boolean)`](#sethandlequit-boolean) | `void` | Sets if the Quit command should be handled on macOS (that means if the application should quit when the command is invoked). |

### registerStartupListener(Listener)

```java
public static void registerStartupListener(Listener listener)
```

Register a listener to receive startup events in single instance mode on
Microsoft Windows or to receive file open events on macOS.
Requests that are already queued may be invoked immediately on the startup listener before this call returns.
Subsequent calls will be from different threads.

**On macOS, you must register this listener on the main thread of your application**.
Otherwise the initial file open event may be lost.
If the application bundle is started through a file association, the file name will also be passed to the
listener and not as an argument to the main class. If your application can only handle the file open event
once it is initialized, you need to store the event and handle it later.
In particular, if you are using JavaFX on macOS, and the application is started through a file association, the JavaFX platform
will not be initialized at that time and `Platform.runLater` will throw an `IllegalStateException`.


**Parameters:**

- `listener` — the listener

### setHandleQuit(boolean)

```java
public static void setHandleQuit(boolean handleQuit)
```

Sets if the Quit command should be handled on macOS (that means if the application
should quit when the command is invoked). This is true be default.


**Parameters:**

- `handleQuit` — true if quit should be handled

## Constructors

| Signature | Description |
|---|---|
| [`StartupNotification()`](#startupnotification) |  |

### StartupNotification()

```java
public StartupNotification()
```

