# Response files

With a response file, you can change the default user selection in all screens. A response file is a text file with name-value pairs that represent installer variables. All screens and form components provided by install4j ensure that user input is bound to appropriate installer variables that are registered for being written to the response file.

Installer variable values are of the general type `java.lang.Object`. In a response file, only variables with values of certain types can be represented: In addition to the default type `java.lang.String`, the types `java.lang.Boolean`, `java.lang.Integer`, `java.util.Date`, `java.lang.String[]` and `int[]` are supported.

In order to let the installer runtime know about these non-default types, the variable name in the response file is followed by a '$' sign and an encoding specifier like 'Integer' or 'Boolean'.

Response file variables are variables that have been registered with

```
String variableName = ...;
context.registerResponseFileVariable(variableName);
```

in the installer. All variables that are bound to form components are automatically registered as response file variables. Also, system screens register response file variables as needed to capture user input.

All installer variables live in the same name space. If you use an installer variable more than once for different user inputs, the response file only captures the last user input. If you would like to optimize your installers for use with a response file, you have to make sure that the relevant variable names are unique within your installer.

A response file can be used to

- Configure the installer for unattended execution mode
- Change the default settings in the GUI and console installer
- Get additional debugging information for an installation

When applying a response file to an installer, all variable definitions are translated into [installer variables](../concepts/variables.md). The response file shares the same mechanism with the variable file offered by the [-varfile](options.md) command-line option. You can add the contents of a response file to a variable file and vice versa.

### Generating response files

There are two ways to generate a response file:

- A response file is generated automatically after an installation is finished. The generated response file is found in the `.install4j` directory inside the installation directory and is named `response.varfile`. When you request debugging information from a user, you should request this file in addition to the installer log file.
- install4j offers a "Create a response file" [action](../beans/actions.md) that allows you to save the response file to a different file in addition to the automatically generated response file. Here, you can also specify variables that you would not like to be included in the response file.

### Applying response files

When an installer is executed, it checks whether a file with the same name and the extension **.varfile** can be found in the same directory and loads that file as the response file. For example, if an installer is called `hello_setup.exe` on Windows, the response file next to it has to be named `hello_setup.varfile`.

You can also specify a response file explicitly with the [-varfile](options.md) installer option.

Response files work with all three [installer modes](installerModes.md), GUI, console and unattended.
