# ApplicationRegistry

Import: `import com.install4j.api.ApplicationRegistry;`

```java
public class ApplicationRegistry
```

The class provides information about applications installed with install4j.

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

| [ApplicationRegistry.ApplicationInfo](ApplicationRegistry.ApplicationInfo.md) | interface | Provides information about an application installed by install4j. |

## Methods

| Signature | Returns | Description |
|---|---|---|
| [`checkApplicationId(File)`](#checkapplicationid-file) | `boolean` | Checks if the application can be safely installed into the given directory. |
| [`isUpdateDirectory(File)`](#isupdatedirectory-file) | `boolean` | Checks if this application is already installed in the given directory. |
| [`getApplicationInfoById(String)`](#getapplicationinfobyid-string) | `ApplicationInfo[]` | Retrieves information about an application installed by install4j via its application id. |
| [`getApplicationInfoByDir(File)`](#getapplicationinfobydir-file) | `ApplicationInfo` | Checks if the specified directory contains an application installed by install4j and retrieves information about it. |
| [`getAddOnApplicationInfoByDir(File)`](#getaddonapplicationinfobydir-file) | `ApplicationInfo[]` | Checks if the specified directory contains an application installed by install4j and retrieves information about the add-on installers in it. |

### checkApplicationId(File)

```java
public static boolean checkApplicationId(File dir)
```

Checks if the application can be safely installed into the given directory.
If this is an add-on installer, it returns true if the directory contains the target app.


**Parameters:**

- `dir` — the directory to be checked

**Returns:** true if safe

### isUpdateDirectory(File)

```java
public static boolean isUpdateDirectory(File dir)
```

Checks if this application is already installed in the given directory.
This is the case if the application ID of the current installer is equal to the application
ID of the already installed application.

Note that if you pass the installation
directory of the current installer to this method, the return value will change to
`true` after the "Install Files" action has run. To check if the current installer
will perform an update installation, use [`InstallerContext.isUpdateInstallation`](context/InstallerContext.md#isupdateinstallation)
which returns a consistent value over the entire lifetime of the installer.


**Parameters:**

- `dir` — the directory to be checked

**Returns:** true if an update is detected

**See also:**

- [InstallerContext.isUpdateInstallation](context/InstallerContext.md#isupdateinstallation)

### getApplicationInfoById(String)

```java
public static ApplicationInfo[] getApplicationInfoById(String id)
```

Retrieves information about an application installed by install4j via its
application id.


**Parameters:**

- `id` — the application id

**Returns:** an array of ApplicationInfo objects containing all installations of
the application with this id. The newest installation is the first element.
Empty array if there are no installations.

### getApplicationInfoByDir(File)

```java
public static ApplicationInfo getApplicationInfoByDir(File dir)
```

Checks if the specified directory contains an application installed by install4j
and retrieves information about it.


**Parameters:**

- `dir` — the base directory to check

**Returns:** an ApplicationInfo object if the directory contains an application installed with install4j,
`null` otherwise.

### getAddOnApplicationInfoByDir(File)

```java
public static ApplicationInfo[] getAddOnApplicationInfoByDir(File dir)
```

Checks if the specified directory contains an application installed by install4j
and retrieves information about the add-on installers in it.


**Parameters:**

- `dir` — the base directory to check

**Returns:** an array of ApplicationInfo objects if the directory contains an application installed with install4j,
`null` otherwise. The array will be empty if there are no add-ons installed.

## Constructors

| Signature | Description |
|---|---|
| [`ApplicationRegistry()`](#applicationregistry) |  |

### ApplicationRegistry()

```java
public ApplicationRegistry()
```

