Compatibility requirements

The latest Java Tracer supports all JVMs version 8 and higher. For additional information about JVM versions below 8, read Supported JVM runtimes.

For a full list of Datadog’s Java version and framework support (including legacy and maintenance versions), read Compatibility Requirements.

Getting started

Before you begin, make sure you’ve already installed and configured the Agent.

Choose your instrumentation method

After you deploy or install and configure your Datadog Agent, the next step is to instrument your application. You can do this in the following ways, depending on the infrastructure your app runs on, the language it’s written in, and the level of configuration you require.

See the following pages for supported deployment scenarios and languages:

Instrument your application

If you are collecting traces from a Kubernetes application, or from an application on a Linux host or container, as an alternative to the following instructions, you can inject the tracing library into your application. Read Injecting Libraries for instructions.

After the agent is installed, to begin tracing your applications:

  1. Download dd-java-agent.jar that contains the latest tracer class files, to a folder that is accessible by your Datadog user:

    wget -O dd-java-agent.jar

    Note: To download the latest build of a specific major version, use the link instead, where X is the desired major version. For example, use for the latest version 1 build. Minor version numbers must not be included. Alternatively, see Datadog’s Maven repository for any specific version.

  2. To run your app from an IDE, Maven or Gradle application script, or java -jar command, with the Continuous Profiler, deployment tracking, and logs injection (if you are sending logs to Datadog), add the -javaagent JVM argument and the following configuration options, as applicable:

    java -javaagent:/path/to/dd-java-agent.jar -Ddd.profiling.enabled=true -XX:FlightRecorderOptions=stackdepth=256 -Ddd.logs.injection=true -Ddd.service=my-app -Ddd.env=staging -Ddd.version=1.0 -jar path/to/your/app.jar

    Note: Enabling profiling may impact your bill depending on your APM bundle. See the pricing page for more information.

Environment VariableSystem PropertyDescription
DD_ENVdd.envYour application environment (production, staging, etc.)
DD_SERVICEdd.serviceThe name of a set of processes that do the same job. Used for grouping stats for your application.
DD_VERSIONdd.versionYour application version (for example, 2.5, 202003181415, 1.3-alpha, etc.)
DD_PROFILING_ENABLEDdd.profiling.enabledEnable the Continous Profiler
DD_LOGS_INJECTIONdd.logs.injectionEnable automatic MDC key injection for Datadog trace and span IDs. See Advanced Usage for details.

Beta: Starting in version 1.18.3, if Agent Remote Configuration is enabled where this service runs, you can set DD_LOGS_INJECTION in the Service Catalog UI.
DD_TRACE_SAMPLE_RATEdd.trace.sample.rateSet a sampling rate at the root of the trace for all services.

Beta: Starting in version 1.18.3, if Agent Remote Configuration is enabled where this service runs, you can set DD_TRACE_SAMPLE_RATE in the Service Catalog UI.
DD_TRACE_SAMPLING_RULESdd.trace.sampling.rulesSet a sampling rate at the root of the trace for services that match the specified rule.

Additional configuration options are described below.

Add the Java Tracer to the JVM

Use the documentation for your application server to figure out the right way to pass in -javaagent and other JVM arguments. Here are instructions for some commonly used frameworks:

If your app is called my_app.jar, create a my_app.conf, containing:


For more information, see the Spring Boot documentation.

Open your Tomcat startup script file, for example on Linux, and add:

CATALINA_OPTS="$CATALINA_OPTS -javaagent:/path/to/dd-java-agent.jar"

Or on Windows, setenv.bat:

set CATALINA_OPTS=%CATALINA_OPTS% -javaagent:"c:\path\to\dd-java-agent.jar"

If a setenv file does not exist, create it in the ./bin directory of the Tomcat project folder.

  • In standalone mode:

    Add the following line to the end of standalone.conf:

JAVA_OPTS="$JAVA_OPTS -javaagent:/path/to/dd-java-agent.jar"
  • In standalone mode and on Windows, add the following line to the end of standalone.conf.bat:
set "JAVA_OPTS=%JAVA_OPTS% -javaagent:X:/path/to/dd-java-agent.jar"
  • In domain mode:

    Add the following line in the file domain.xml, under the tag server-groups.server-group.jvm.jvm-options:

<option value="-javaagent:/path/to/dd-java-agent.jar"/>

For more details, see the JBoss documentation.

If you use to start Jetty as a service, edit it to add:

JAVA_OPTIONS="${JAVA_OPTIONS} -javaagent:/path/to/dd-java-agent.jar"

If you use start.ini to start Jetty, add the following line (under --exec, or add --exec line if it isn’t there yet):


In the administrative console:

  1. Select Servers. Under Server Type, select WebSphere application servers and select your server.
  2. Select Java and Process Management > Process Definition.
  3. In the Additional Properties section, click Java Virtual Machine.
  4. In the Generic JVM arguments text field, enter:

For additional details and options, see the WebSphere docs.


  • If you’re adding the -javaagent argument to your java -jar command, it needs to be added before the -jar argument, as a JVM option, not as an application argument. For example:

    java -javaagent:/path/to/dd-java-agent.jar -jar my_app.jar

    For more information, see the Oracle documentation.

  • Never add dd-java-agent to your classpath. It can cause unexpected behavior.

Automatic instrumentation

Automatic instrumentation for Java uses the java-agent instrumentation capabilities provided by the JVM. When a java-agent is registered, it can modify class files at load time.

Note: Classes loaded with remote ClassLoader are not instrumented automatically.

Instrumentation may come from auto-instrumentation, the OpenTracing API, or a mixture of both. Instrumentation generally captures the following info:

  • Timing duration is captured using the JVM’s NanoTime clock unless a timestamp is provided from the OpenTracing API
  • Key/value tag pairs
  • Errors and stack traces which are unhandled by the application
  • A total count of traces (requests) flowing through the system


If needed, configure the tracing library to send application performance telemetry data as you require, including setting up Unified Service Tagging. Read Library Configuration for details.

Further Reading