# Updates

On the "Installer->Update Options" step, you can configure how an installer should behave in the event of an update. An update occurs when the user installs an application into a directory where an installation with the same application ID already exists.

![](../images/ui/updates_options.png)

Typically, minor upgrades of an application should be installed into the same directory as earlier installations. By default, new install4j projects contain a "Set installation directory" action that finds the previous installation directory so that the user is guided into installing the application into the same directory. If this behavior is not desired, you can switch off these suggestions or change the application ID on the "Installer->Update Options" step.

### Updates into the same installation directory

The following points are of interest with respect to updates into the same installation directory:

- Generated installers will refuse to install on top of installations with a different application ID by default. You can change this behavior with the "Validate application id" property of the installation directory chooser on the "Installation location" screen.
- Generated installers will detect if any of the previously installed launchers are still running and will ask the user to shut down these applications. This happens when the "Install files" action or a "Check for running processes" action is executed.
- Deployed services will be stopped and uninstalled before the installation. This happens when the "Install files" action is executed. You can optionally stop your services earlier with the "Stop a service" action if your update process requires it.
- During an update, the installation databases will be merged, so that files, menu entries, file associations and other modifications from old installations can still be uninstalled when the uninstaller is executed.
- After an update, only the uninstallation actions of the newer installation will be executed when the uninstaller is executed. However, the auto-uninstall actions from previous installations will be executed, too, for example, the uninstallation of a service that was registered by an "Install service" action during the installation.

If you would like to uninstall the previous installation before installing any new files, you can add the "Execute previous uninstaller" action before the "Install files" action. In this context, the [uninstallation policies](../concepts/files.md) that exclude updates are important. With these uninstallation policies, you can preserve certain files for updates but uninstall them when the user manually invokes the uninstaller. The uninstaller invoked by the "Execute previous uninstaller" action is running in unattended mode. You can use

```
!context.isUninstallForUpgrade()
```

to exclude certain actions for an update uninstaller.

### Add-on installers

install4j offers two types of installers that can be selected on the "Installer->Update options" step:

- **Regular installers** — This option generates standalone installers.
- **Add-on installers** — This generates an installer that can **only** be installed on top of an installation with a specified application ID. An add-on installer does not have a separate uninstaller. This is useful to distribute additional files that do not change the version number of the installation.   If the add-on installer type is selected, you have to specify the application ID for the base application.
