Install the Java agent

This document details how to download and install the Java agent. Before installing the agent, review the Java agent compatibility and requirements. To learn more about what New Relic APM for Java does, see Introduction to New Relic for Java.

This document is for standard Java agent installation. However, some tools have separate installation docs. See: Heroku installation, Maven installation, or Scala installation.

Download the agent

To download the Java agent:

  1. Log in to New Relic.

  2. From the account dropdown in the New Relic UI, select Account settings.

  3. In the right sidebar, download the agent for your platform.

The zip file includes two required files for installation:

  • newrelic.jar: This contains the agent class files.
  • newrelic.yml: This contains configuration information for the New Relic agent, including your license key, application name, SSL settings, etc. New Relic recommends you change the default newrelic.yml file permissions to be read/write only for the owner of the app server process.

On server startup, the agent searches for newrelic.yml in the directory that contains newrelic.jar. New Relic writes the agent log to a sub-directory in the same location, named logs.

Install the agent

To install the Java agent:

  1. In your app server's root directory, create a new directory named newrelic.
  2. Unpack the agent download file into the newrelic directory.

  3. In newrelic.yml, set the app_name setting to a meaningful name.
  4. Back up the newrelic.yml configuration file.

  5. Pass this switch to the JVM (for detailed instructions for your framework, see Include the Java agent with a JVM argument):

    -javaagent:/full/path/to/newrelic.jar
  6. If you use these tools or frameworks, see these documents for additional steps:

  7. Start or restart your app server.

Wait a few minutes for the application data to appear in the APM Overview page. If nothing appears, see No data appears.

What's next?

After you install the agent on your Java app, here are some suggested next steps:

For more help

Join the discussion about Java monitoring in the New Relic Online Technical Community! The Technical Community is a public platform to discuss and troubleshoot your New Relic toolset.

If you need additional help, get support at support.newrelic.com.