Installer - Custom code

## Installer - Custom code |
previous | up | next

On this tab of the Installer step you configure the location of the custom code for your own extensions and the custom actions that are performed during installation and uninstallation.

| In the [Custom code] section you can specify the location of your custom code for extensions that use the install4j API. The following custom code location types are available: Class or resource files Directories Archives All classes used by your custom code have to be included in these locations (except for Java runtime classes and install4j framework classes). The control buttons allow you to modify the contents of the list of custom code locations: Add custom code location (key `INS`) Displays the custom code entry dialog where you can define a new entry in the list of custom code locations. Remove custom code location (key `DEL`) Removes the currently selected custom code location without further confirmation. Also available from the context menu. Move custom code location up (key `ALT-UP`) Moves the selected custom code location up one position in the list. Also available from the context menu. Move custom code location down (key `ALT-DOWN`) Moves the selected custom code location down one position in the list. Also available from the context menu. After you have chosen your custom code locations, the chooser buttons for the custom action classes (in the `Custom actions` section) and for the custom screen classes (the Add action on the Installer features tab in install4j Enterprise Edition) as well as the class selectors on the advanced tasks tab will show a list of appropriate classes.

| You can perform custom actions before and after the installation as well as before and after the uninstallation. When custom actions are actually run depends on the media file type: GUI installers For GUI installers, the custom actions are run during the installation phase in the installer and during the uninstallation phase in the uninstaller. archives For archives, the install actions are run the first time the application is started. Pre-install and post-install action are both executed. An install action is a Java class derived from `com.install4j.api.InstallAction`, an uninstall action must be derived from `com.install4j.api.UninstallAction`. Further help on writing custom actions is available in the API description. Custom actions and all classes used by them that are not provided by the Java runtime must be available in the custom code locations defined in the `Custom code` section on this tab. To easily select a custom action, you can use the [...] chooser buttons next to the text fields. A custom class selector will be brought up that shows all appropriate classes present in the custom jar file. If you expect a class to be shown and it is not there, please check whether your custom code is set up correctly and whether your class extends the correct class. Note: Please check the Hello World demo project for examples of custom actions.