---
title: Name your Java application
source: https://docs.newrelic.com/docs/apm/agents/java-agent/configuration/name-your-java-application
---

[New Relic's Java agent](https://docs.newrelic.com/docs/agents/java-agent/getting-started/introduction-new-relic-java) gives you several ways to change the application name that is reported and displayed in APM. This document gives you an overview of those naming options.

For a general overview of APM app naming (not Java-specific), see [Name your application](https://docs.newrelic.com/docs/agents/manage-apm-agents/app-naming/name-your-application).

## Set or change app name [#naming-options]

APM differentiates applications by the name they report as. Data continuity breaks when you change the application name. To change an application's name without breaking data continuity, use the UI alias-change option.

Here are the ways to change your Java application's name:

| Naming method                                       | Description                                                                                                                                                                                                                                                                                                                                                             |
| --------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Recommended: Configure `app_name` in `newrelic.yml` | [Configure your `newrelic.yml` file](https://docs.newrelic.com/docs/agents/java-agent/configuration/java-agent-configuration-config-file#cfg-app_name) to set your app name. This is the recommended and most commonly used option: ````yml app_name: My Application ```  ````                                                                                          |
| Configure `app_name` using JVM arguments            | [Set a system property with JVM arguments](https://docs.newrelic.com/docs/agents/java-agent/configuration/java-agent-configuration-config-file#System_Properties) to set unique app names for multiple applications that report to the same Java agent: ````ini -Dnewrelic.config.app_name="My App" ```  ````                                                           |
| Set app name using environment variables            | [Set an environment variable](https://docs.newrelic.com/docs/agents/java-agent/configuration/java-agent-configuration-config-file#Environment_Variables) to easily set app names during the deployment of containers, or to ensure an app name stays the same through multiple iterations of a `newrelic.yml` file: ````sh export NEW_RELIC_APP_NAME="My App" ```  ```` |
| Automatic application naming                        | [Enable automatic application naming](https://docs.newrelic.com/docs/agents/java-agent/configuration/automatic-application-naming) in your `newrelic.yml` file if you want applications named for their context, filter, servlet, or request attribute: ````yml enable_auto_app_naming: true ```  ````                                                                  |
| Change alias via UI                                 | [Change an application's alias](https://docs.newrelic.com/docs/agents/manage-apm-agents/app-naming/name-your-application#app-alias) to change only the displayed name in the UI. This does not change the name the application reports as. This does not break data continuity, unlike all other options.                                                               |

> #### 💡 TIP
>
> Note that some methods [take precedence over others](https://docs.newrelic.com/docs/agents/java-agent/configuration/java-agent-configuration-config-file#config-options-precedence).

## Use multiple app names [#multiple]

You can use multiple app names to aggregate data from several applications under the same name in APM (sometimes referred to as "rolling up" your data). For more about how multiple app names work, see [Use multiple app names](https://docs.newrelic.com/docs/agents/manage-apm-agents/app-naming/use-multiple-names-app).

In Java, you can set up to three app names. The primary app name is first, while the second and third names are used for the more general data aggregation categories.

**Java config file**

Here is an example of setting multiple names in the [`newrelic.yml` file](https://docs.newrelic.com/docs/agents/java-agent/configuration/java-agent-configuration-config-file#cfg-app_name):

````yml
app_name: My Application;My Application 2;My application 3
```

````

**Java environment variable**

Here is an example of setting multiple names as [environment variable](https://docs.newrelic.com/docs/agents/java-agent/configuration/java-agent-configuration-config-file#Environment_Variables):

````sh
export NEW_RELIC_APP_NAME="My Application;My Application 2;My application 3"
```

````

**System properties**

> #### ⚠️ IMPORTANT
>
> If you set multiple application names using system properties on the Java command line, remember to quote the command-line parameter because of the ; character.

Here is an example of setting multiple names as a [system property](https://docs.newrelic.com/docs/agents/java-agent/configuration/java-agent-configuration-config-file#Environment_Variables):

````ini
-Dnewrelic.config.app_name="My Application;My Application 2;My application 3"
```

````
