---
title: Enabling the Java Profiler
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: >-
  Docs > Continuous Profiler > Enabling the Profiler > Enabling the Java
  Profiler
---

# Enabling the Java Profiler

The profiler is shipped within Datadog SDKs. If you are already using [APM to collect traces](https://docs.datadoghq.com/tracing/trace_collection.md) for your application, you can skip installing the library and go directly to enabling the profiler.

## Requirements{% #requirements %}

For a summary of the minimum and recommended runtime and tracer versions across all languages, read [Supported Language and Tracer Versions](https://docs.datadoghq.com/profiler/enabling/supported_versions.md).

{% tab title="Linux" %}
**Available profile types**:

- CPU
- Wallclock (latency)
- Allocations
- Live heap (memory leak detection)
- Exception profiling
- I/O profiling

| JDK Distribution    | Minimum Version                | Notes                                                                                                                      |
| ------------------- | ------------------------------ | -------------------------------------------------------------------------------------------------------------------------- |
| OpenJDK             | 8u352+, 11.0.17+, 17.0.5+, 21+ | Includes builds from Amazon Corretto, Azul Zulu, Eclipse Temurin, BellSoft Liberica, and other OpenJDK-based distributions |
| Oracle JDK          | 8u351+, 11.0.17+, 17.0.5+, 21+ |
| OpenJ9 JDK          | 8u372+, 11.0.18+, 17.0.6+      | Includes Eclipse OpenJ9, IBM JDK, and IBM Semeru Runtime                                                                   |
| Azul Platform Prime | 23.05.0.0+                     |

{% /tab %}

{% tab title="Windows" %}
**Available profile types**:

- CPU
- Allocations
- I/O profiling
- Exception

| JDK Distribution | Minimum Version                    | Notes                                                                                                                      |
| ---------------- | ---------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| OpenJDK          | 8u282+, 11.0.17+, 17.0.5+, 21.0.3+ | Includes builds from Amazon Corretto, Azul Zulu, Eclipse Temurin, BellSoft Liberica, and other OpenJDK-based distributions |
| Oracle JDK       | 11.0.17+, 17.0.5+, 21.0.3+         | JFR may require commercial license. Oracle JDK 8u40+ supported with limited features (CPU profiling only)                  |
| Azul Zulu        | 8u212+, 11.0.17+, 17.0.5+, 21.0.3+ |
| GraalVM          | 17.0.11+, 21.0.3+                  | JIT mode and native-image(AOT)                                                                                             |

{% /tab %}

- All JVM-based languages, such as Java, Scala, Groovy, Kotlin, and Clojure are supported.

- The profiler supports only actively maintained LTS JDK versions and the most recent General Availability (GA) JDK releases.

- Java Profiler is not supported on serverless environments.

## Installation{% #installation %}

To begin profiling applications:

1. Install and run Datadog Agent v6+. Datadog recommends using [Datadog Agent v7+](https://app.datadoghq.com/account/settings/agent/latest?platform=overview). If you don't have APM enabled to set up your application to send data to Datadog, in your Agent, set the `DD_APM_ENABLED` environment variable to `true` and listening to the port `8126/TCP`.

1. Download `dd-java-agent.jar`, which contains the Java Agent class files:

   {% tab title="Wget" %}

   ```shell
   wget -O dd-java-agent.jar 'https://dtdg.co/latest-java-tracer'
   ```

   {% /tab %}

   {% tab title="cURL" %}

   ```shell
   curl -Lo dd-java-agent.jar 'https://dtdg.co/latest-java-tracer'
   ```

   {% /tab %}

   {% tab title="Dockerfile" %}

   ```dockerfile
   ADD 'https://dtdg.co/latest-java-tracer' dd-java-agent.jar
   ```

   {% /tab %}

1. Enable the profiler by setting `-Ddd.profiling.enabled` flag or `DD_PROFILING_ENABLED` environment variable to `true`. Specify `dd.service`, `dd.env`, and `dd.version` so you can filter and group your profiles across these dimensions:

   {% tab title="Command arguments" %}

   ```shell
   java \
       -javaagent:dd-java-agent.jar \
       -Ddd.service=<YOUR_SERVICE> \
       -Ddd.env=<YOUR_ENVIRONMENT> \
       -Ddd.version=<YOUR_VERSION> \
       -Ddd.profiling.enabled=true \
       -jar <YOUR_SERVICE>.jar <YOUR_SERVICE_FLAGS>
   ```

   {% /tab %}

   {% tab title="Environment variables" %}

   ```shell
   export DD_SERVICE=<YOUR_SERVICE>
   export DD_ENV=<YOUR_ENV>
   export DD_VERSION=<YOUR_VERSION>
   export DD_PROFILING_ENABLED=true
   java \
       -javaagent:dd-java-agent.jar \
       -jar <YOUR_SERVICE>.jar <YOUR_SERVICE_FLAGS>
   ```

   {% /tab %}

**Note**: The `-javaagent` argument needs to be before `-jar`. This adds it as a JVM option rather than an application argument. For more information, see the [Oracle documentation](https://docs.oracle.com/javase/7/docs/technotes/tools/solaris/java.html).

Optional: Set up [Source Code Integration](https://docs.datadoghq.com/integrations/guide/source-code-integration.md?tab=java) to connect your profiling data with your Git repositories.

After a couple of minutes, your profiles appear on the [Datadog APM > Profiling page](https://app.datadoghq.com/profiling).

For more information on available profile types, see [Profile Types](https://docs.datadoghq.com/profiler/profile_types.md?tab=java).

**Note**: For GraalVM native-image applications, see [Enabling the Profiler for GraalVM Native Image](https://docs.datadoghq.com/profiler/enabling/graalvm.md).

## Configuration{% #configuration %}

In addition to the environment, service, and version variables shown in the installation steps, you can apply custom tags to uploaded profiles with `DD_TAGS` (a comma-separated list of `<key>:<value>` pairs such as `layer:api, team:intake`).

For additional configuration options, see the [Configuration reference](https://docs.datadoghq.com/profiler/profiler_troubleshooting/java.md#configuration-reference) in the troubleshooting guide.

## Not sure what to do next?{% #not-sure-what-to-do-next %}

The [Getting Started with Profiler](https://docs.datadoghq.com/getting_started/profiler.md) guide takes a sample service with a performance problem and shows you how to use Continuous Profiler to understand and fix the problem.

Facing issues while enabling the profiler or need troubleshooting guidance? See the [Java Profiler Troubleshooting](https://docs.datadoghq.com/profiler/profiler_troubleshooting/java.md) guide.

## Further Reading{% #further-reading %}

- [Getting Started with Profiler](https://docs.datadoghq.com/getting_started/profiler.md)
- [Learn more about available profile visualizations](https://docs.datadoghq.com/profiler/profile_visualizations.md)
- [Fix problems you encounter while using the profiler](https://docs.datadoghq.com/profiler/profiler_troubleshooting/java.md)
