Step 3: Configure Launchers

## Step 3: Configure Launchers |

| Launchers are responsible for starting your application. There are two types of launchers: Generated launchers install4j can generate native launchers that start your application. For example, on Windows, a `.exe` file will be created that among other things takes care of finding a suitable JRE, displaying appropriate error messages in case of need and then starts your application. Using launchers generated by install4j has numerous advantages as compared to using home-grown batch files and shell scripts. Each launcher definition is compiled separately for each defined media set. Therefore, for the majority of all cases, a single launcher definition will be sufficient to start your application. If, for example, your distribution contains two GUI applications and a command line application, you have to define 3 launchers, regardless of how many media files you define. When your application is started with a launcher generated by install4j, you can query the system property install4j.appDir to get the installation directory and and install4j.exeDir to get the directory where the launcher resides. Use `System.getProperty("install4j.appDir")` and `System.getProperty("install4j.exeDir")` to access these values. External launchers If you already have an external launcher for your application, you can let install4j use that launcher instead of generating one. Since external launchers are most likely platform dependent, you will have to add external launchers for each platform that is targeted by your media files. Make sure to exclude the irrelevant launchers in your media file definitions in this case. To define a new launcher, you double-click on the new launcher entry in the list of defined launchers or choose Launcher->New launcher from install4j's main menu. The launcher wizard will then be displayed. Once you have completed all steps of the launcher wizard, a new launcher entry will be displayed in the list of launchers. The icon of a launcher indicates if it is a GUI application launcher Console application launcher Service application launcher External launcher

| In the list of launchers you you can Reorder launcher definitions Launcher definitions are reordered by dragging them with the mouse to the desired location. While dragging, the insertion bar shows you where the launcher definition would be dropped. The order of launchers is not relevant for install4j, reordering is provided only for the purpose of letting you arrange the launcher definitions according to your personal preferences. Copy launcher definitions Launcher definitions are copied by copy-dragging them (e.g. on Windows, press `CTRL` while dragging) or using the [Copy Launcher] action while the source launcher is selected. The name of the copied launcher definition will be prefixed with "Copy of". You can change this default name by renaming the launcher definition (see below). Rename launcher definitions Launcher definitions can be renamed by selecting Rename Launcher from the context menu or Launcher->Rename launcher from install4j's main menu. An input dialog will be displayed where the current name can be edited. Please note that the name of the launcher is for your own information only and is not used in the distribution. Delete launcher definitions Launcher definitions can be deleted by using the [Delete Launcher] action or by hitting the `DEL` key while the launcher definition is selected. Edit a launcher definition Launcher definitions can be edited by using the [Edit Launcher] action or by hitting the `ENTER` key while the launcher definition is selected. The launcher wizard will be displayed for the selected launcher definition. Please note that you can directly access any step in the wizard by clicking on it in the index.