Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions content/en/tracing/trace_collection/compatibility/java.md
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,44 @@
- Loading multiple Java Agents that perform APM/tracing functions is not a recommended or supported configuration.
- When enabling the tracer for Java 24+, you may see warnings related to JNI native access or `sun.misc.Unsafe` memory access. Suppress these warnings by adding the `--illegal-native-access=allow` and `--sun-misc-unsafe-memory-access=allow` environment variables right before the `-javaagent:/path/to/dd-java-agent.jar` argument. See [JEP 472][13] and [JEP 498][14] for more information.

## Ahead-of-time (AOT) class loading & linking support

To improve startup time, Ahead-of-time (AOT) class loading & linking makes application classes instantly available in a loaded and linked state when the JVM starts. See [JEP 483][15] and [JEP 514][16] for more information.

Check notice on line 299 in content/en/tracing/trace_collection/compatibility/java.md

View workflow job for this annotation

GitHub Actions / vale

Datadog.sentencelength

Suggestion: Try to keep your sentence length to 25 words or fewer.

### Requirements

Use:

- Java 25 or later
- [Datadog Java tracer][1] 1.57.0 or later

### Setup

To set up AOT class loading & linking for APM, add the Datadog Java tracer during the training run:
```shell
java -javaagent:/path/to/dd-java-agent.jar -XX:AOTCacheOutput=app.aot -jar App.jar
```

#### Usage

During production, add the same Datadog Java tracer along with the previously cached training data:
```shell
java -javaagent:/path/to/dd-java-agent.jar -XX:AOTCache=app.aot -jar App.jar
```

You can view traces using the [Trace Explorer][9].

{{% collapse-content title="Troubleshooting" level="h4" %}}
##### Not attaching the Datadog Java tracer during the training run

If you see this warning in production, it means the Datadog Java tracer wasn't attached during training:
```
Mismatched values for property jdk.module.addmods: java.instrument specified during runtime but not during dump time
```
The JVM cannot then use the AOT cache to improve startup time. The solution is to attach the tracer during training.

{{% /collapse-content %}}

## GraalVM Native Image support

GraalVM Native Image is a technology that allows you to compile Java applications into native executables. The Datadog Java tracer supports GraalVM Native Image. This allows you to compile your applications into native executables while still benefiting from the tracing capabilities offered by the library.
Expand Down Expand Up @@ -487,3 +525,5 @@
[12]: /tracing/trace_collection/library_config/#agent
[13]: https://openjdk.org/jeps/472
[14]: https://openjdk.org/jeps/498
[15]: https://openjdk.org/jeps/483
[16]: https://openjdk.org/jeps/514
Loading