File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
native-image/preserve-package Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 11# GraalVM Native Image: Using the ` -H:Preserve ` Option
22
3+ This demo shows how to use GraalVM Native Image’s experimental -H: Preserve
4+ option to ensure classes accessed via reflection are included in your native
5+ executable. You’ll learn how to identify missing classes, use build reports, and
6+ apply the new option for reliable runtime behavior.
7+
8+ ## Introduction
9+
310Java reflection lets a running program inspect and invoke classes, fields, and
411methods at runtime. GraalVM Native Image supports many common cases
512automatically by performing static analysis to discover what must be included in
@@ -120,8 +127,9 @@ This happens because static analysis did not discover that `StringReverser` (and
120127
121128GraalVM 25 adds an experimental reporting option to help you find dynamic access
122129before it breaks at runtime. With ` -H:+ReportDynamicAccess ` , in conjunction with
123- ` --emit=build-report ` , the Native Image build report highlights reflective usage
124- present in the image.
130+ ` --emit=build-report ` , the Native Image [ build
131+ report] ( https://www.graalvm.org/latest/reference-manual/native-image/overview/build-report/ )
132+ highlights reflective usage present in the image.
125133
126134The ` native-default ` profile already enables this feature:
127135
You can’t perform that action at this time.
0 commit comments