GraalVM Native Image Documentation Lookup
Look up GraalVM native image documentation via WebFetch and cross-reference with project-specific
native compilation patterns in the ide-sidecar codebase.
Determine the Project's JDK Version
The project uses GraalVM CE JDK installed via SDKMAN. Check the current version:
grep -i 'java\|jdk' .sdkmanrc 2>/dev/null; grep 'maven.compiler.release\|java.version' pom.xml | head -3
Extract the major JDK version (e.g., 21).
Documentation URL Map
GraalVM Reference
GraalVM docs support version-specific URLs by JDK version. Always use the project's JDK version:
- Version-specific (preferred):
https://www.graalvm.org/jdk{version}/reference-manual/native-image
- Latest (fallback):
https://www.graalvm.org/latest/reference-manual/native-image
For example, if the project uses JDK 21, use https://www.graalvm.org/jdk21/reference-manual/native-image.
| Topic |
Path |
Use For |
| Overview |
/ |
General concepts, how native image works |
| Reflection |
/dynamic-features/Reflection/ |
Reflection configuration, reflect-config.json format |
| JNI |
/dynamic-features/JNI/ |
JNI configuration for native libraries |
| Resources |
/dynamic-features/Resources/ |
Including files/resources in the native executable |
| Build Configuration |
/overview/BuildConfiguration/ |
Build-time args, --initialize-at-run-time, --report-unsupported-elements-at-runtime |
| Compatibility |
/metadata/Compatibility/ |
Unsupported features, limitations |
Quarkus Native Guides
Quarkus guides also support versioned URLs (see quarkus-docs skill for version lookup).
- Version-specific (preferred):
https://quarkus.io/version/{major.minor}/guides
- Latest (fallback):
https://quarkus.io/guides
| Topic |
Path |
Use For |
| Building Native |
/building-native-image |
Quarkus-specific native image building |
| Native Tips |
/writing-native-applications-tips |
@RegisterForReflection, troubleshooting, common patterns |
Navigation Strategy
- Determine the project's JDK version from
.sdkmanrc or pom.xml (see above)
- Match the user's question to one or more topics from the tables above
- Check project-specific files first — see Project-Specific Locations below
- Fetch the relevant page(s) using version-specific URLs — use a targeted prompt to extract
only the relevant section
- If a question spans topics (e.g., "reflection for a JNI class"), fetch both pages
- For questions not clearly in the table, use WebSearch:
site:graalvm.org native-image <topic> or site:quarkus.io/guides/ native <topic>
Topic Selection Examples
| User asks about… |
Check Project Files |
Fetch Docs |
| "ClassNotFoundException in native" |
ReflectionConfiguration.java |
Reflection + Native Tips |
| "how to register a class for reflection" |
ReflectionConfiguration.java |
Native Tips |
| "UnsatisfiedLinkError with compression lib" |
*NativeLoader.java |
JNI |
| "ExceptionInInitializerError during build" |
application.yml native section |
Build Configuration |
| "resource not found in native executable" |
application.yml native section |
Resources |
| "is dynamic class loading supported?" |
— |
Compatibility |
| "make test-native failing" |
Test logs, application.yml |
Building Native |
Project-Specific Locations
Rather than duplicating codebase details here, search these key locations to understand the
current state of the project's native configuration:
Reflection Registration
- Project classes: Search for
@RegisterForReflection across src/main/java/ to see which
classes are annotated directly
- Third-party classes: Read
src/main/java/.../application/ReflectionConfiguration.java — this
is the centralized registration point for external library classes that need reflection
- Convention: annotate project classes directly; add third-party classes to
ReflectionConfiguration.java
Native Library Loading
- Loader pattern: Read
src/main/java/.../application/SnappyNativeLoader.java and
ZstdNativeLoader.java — these demonstrate the pattern for extracting native libs at startup
- Shared utility: Search for
NativeLibraryUtil to find the extraction helper
Native Image Configuration Files
- Config directory:
src/main/resources/META-INF/native-image/ — organized by library
(e.g., com.github.luben/zstd-jni/, com.google.protobuf/). List this directory to see
current configs.
- Contents:
reflect-config.json, jni-config.json, resource-config.json per library
Build Arguments
- Native build config: Read the
quarkus.native section in
src/main/resources/application.yml — contains additional-build-args (including
--initialize-at-run-time class list), march, and resources.includes
- To find current init-at-run-time classes: grep for
initialize-at-run-time in
application.yml
Common Error Patterns
When a user reports a native-mode error, check this table for likely causes, then search the
project files to confirm:
| Error at Runtime |
Likely Cause |
Where to Fix |
ClassNotFoundException |
Missing reflection registration |
@RegisterForReflection or ReflectionConfiguration.java |
NoSuchMethodException |
Method not registered for reflection |
reflect-config.json or @RegisterForReflection(methods=true) |
MissingResourceException / file not found |
Resource not included in native executable |
quarkus.native.resources.includes in application.yml |
JNI UnsatisfiedLinkError |
Native library not loaded or JNI not configured |
*NativeLoader.java pattern + jni-config.json |
ExceptionInInitializerError during build |
Static initializer needs runtime state |
--initialize-at-run-time in application.yml |
UnsupportedFeatureException |
Feature not available in native mode |
Refactor; check GraalVM Compatibility docs |
Output Format
- Diagnosis first: explain what's happening and why it occurs in native mode
- Project-specific solution: show exactly where and how to apply the fix in this codebase, with
file paths and existing patterns
- Official reference: relevant excerpt from GraalVM/Quarkus docs
- Verification: how to verify the fix (
make test-native or specific test commands)
- Link back to the doc URL so the user can read further
Tips
- Always check
ReflectionConfiguration.java before adding a new reflect-config.json file — the
centralized approach is preferred for third-party classes in this project
- When adding a new third-party library dependency, proactively check if it uses reflection, JNI, or
resources that need native image configuration
- Native build failures are often only caught by
make test-native, not make test — always
recommend running native tests when changes touch serialization, reflection, or new dependencies
- If a doc URL returns sparse content or a 404, use WebSearch as fallback to find the current page
- For Quarkus-specific native patterns (like
@RegisterForReflection), prefer the Quarkus Native
Tips guide — it's more practical than the GraalVM reference docs
1---2name: graalvm-docs3description: Use when the user asks about GraalVM native image compilation, reflection registration, native build failures, or native executable testing. Triggers on questions like "@RegisterForReflection", "native image build error", "reflection-config.json", "native library loading", "GraalVM substitution", "--initialize-at-run-time", "native executable test", "native build args", "ClassNotFoundException in native", or "make test-native".4---56# GraalVM Native Image Documentation Lookup78Look up GraalVM native image documentation via WebFetch and cross-reference with project-specific9native compilation patterns in the ide-sidecar codebase.1011## Determine the Project's JDK Version1213The project uses GraalVM CE JDK installed via SDKMAN. Check the current version:1415```bash16grep -i 'java\|jdk' .sdkmanrc 2>/dev/null; grep 'maven.compiler.release\|java.version' pom.xml | head -317```1819Extract the major JDK version (e.g., `21`).2021## Documentation URL Map2223### GraalVM Reference2425GraalVM docs support version-specific URLs by JDK version. Always use the project's JDK version:2627- **Version-specific (preferred)**: `https://www.graalvm.org/jdk{version}/reference-manual/native-image`28- **Latest (fallback)**: `https://www.graalvm.org/latest/reference-manual/native-image`2930For example, if the project uses JDK 21, use `https://www.graalvm.org/jdk21/reference-manual/native-image`.3132| Topic | Path | Use For |33| ------------------- | ------------------------------- | --------------------------------------------------------------------------------------- |34| Overview | `/` | General concepts, how native image works |35| Reflection | `/dynamic-features/Reflection/` | Reflection configuration, `reflect-config.json` format |36| JNI | `/dynamic-features/JNI/` | JNI configuration for native libraries |37| Resources | `/dynamic-features/Resources/` | Including files/resources in the native executable |38| Build Configuration | `/overview/BuildConfiguration/` | Build-time args, `--initialize-at-run-time`, `--report-unsupported-elements-at-runtime` |39| Compatibility | `/metadata/Compatibility/` | Unsupported features, limitations |4041### Quarkus Native Guides4243Quarkus guides also support versioned URLs (see `quarkus-docs` skill for version lookup).4445- **Version-specific (preferred)**: `https://quarkus.io/version/{major.minor}/guides`46- **Latest (fallback)**: `https://quarkus.io/guides`4748| Topic | Path | Use For |49| --------------- | ----------------------------------- | ---------------------------------------------------------- |50| Building Native | `/building-native-image` | Quarkus-specific native image building |51| Native Tips | `/writing-native-applications-tips` | `@RegisterForReflection`, troubleshooting, common patterns |5253## Navigation Strategy54551. **Determine the project's JDK version** from `.sdkmanrc` or `pom.xml` (see above)562. **Match the user's question to one or more topics** from the tables above573. **Check project-specific files first** — see Project-Specific Locations below584. **Fetch the relevant page(s)** using version-specific URLs — use a targeted prompt to extract59 only the relevant section605. **If a question spans topics** (e.g., "reflection for a JNI class"), fetch both pages616. **For questions not clearly in the table**, use WebSearch:62 `site:graalvm.org native-image <topic>` or `site:quarkus.io/guides/ native <topic>`6364### Topic Selection Examples6566| User asks about… | Check Project Files | Fetch Docs |67| ------------------------------------------- | -------------------------------- | ------------------------ |68| "ClassNotFoundException in native" | `ReflectionConfiguration.java` | Reflection + Native Tips |69| "how to register a class for reflection" | `ReflectionConfiguration.java` | Native Tips |70| "UnsatisfiedLinkError with compression lib" | `*NativeLoader.java` | JNI |71| "ExceptionInInitializerError during build" | `application.yml` native section | Build Configuration |72| "resource not found in native executable" | `application.yml` native section | Resources |73| "is dynamic class loading supported?" | — | Compatibility |74| "make test-native failing" | Test logs, `application.yml` | Building Native |7576## Project-Specific Locations7778Rather than duplicating codebase details here, **search these key locations** to understand the79current state of the project's native configuration:8081### Reflection Registration8283- **Project classes**: Search for `@RegisterForReflection` across `src/main/java/` to see which84 classes are annotated directly85- **Third-party classes**: Read `src/main/java/.../application/ReflectionConfiguration.java` — this86 is the centralized registration point for external library classes that need reflection87- **Convention**: annotate project classes directly; add third-party classes to88 `ReflectionConfiguration.java`8990### Native Library Loading9192- **Loader pattern**: Read `src/main/java/.../application/SnappyNativeLoader.java` and93 `ZstdNativeLoader.java` — these demonstrate the pattern for extracting native libs at startup94- **Shared utility**: Search for `NativeLibraryUtil` to find the extraction helper9596### Native Image Configuration Files9798- **Config directory**: `src/main/resources/META-INF/native-image/` — organized by library99 (e.g., `com.github.luben/zstd-jni/`, `com.google.protobuf/`). List this directory to see100 current configs.101- **Contents**: `reflect-config.json`, `jni-config.json`, `resource-config.json` per library102103### Build Arguments104105- **Native build config**: Read the `quarkus.native` section in106 `src/main/resources/application.yml` — contains `additional-build-args` (including107 `--initialize-at-run-time` class list), `march`, and `resources.includes`108- **To find current init-at-run-time classes**: grep for `initialize-at-run-time` in109 `application.yml`110111## Common Error Patterns112113When a user reports a native-mode error, check this table for likely causes, then search the114project files to confirm:115116| Error at Runtime | Likely Cause | Where to Fix |117| ------------------------------------------- | ----------------------------------------------- | --------------------------------------------------------------- |118| `ClassNotFoundException` | Missing reflection registration | `@RegisterForReflection` or `ReflectionConfiguration.java` |119| `NoSuchMethodException` | Method not registered for reflection | `reflect-config.json` or `@RegisterForReflection(methods=true)` |120| `MissingResourceException` / file not found | Resource not included in native executable | `quarkus.native.resources.includes` in `application.yml` |121| JNI `UnsatisfiedLinkError` | Native library not loaded or JNI not configured | `*NativeLoader.java` pattern + `jni-config.json` |122| `ExceptionInInitializerError` during build | Static initializer needs runtime state | `--initialize-at-run-time` in `application.yml` |123| `UnsupportedFeatureException` | Feature not available in native mode | Refactor; check GraalVM Compatibility docs |124125## Output Format126127- **Diagnosis first**: explain what's happening and why it occurs in native mode128- **Project-specific solution**: show exactly where and how to apply the fix in this codebase, with129 file paths and existing patterns130- **Official reference**: relevant excerpt from GraalVM/Quarkus docs131- **Verification**: how to verify the fix (`make test-native` or specific test commands)132- Link back to the doc URL so the user can read further133134## Tips135136- Always check `ReflectionConfiguration.java` before adding a new `reflect-config.json` file — the137 centralized approach is preferred for third-party classes in this project138- When adding a new third-party library dependency, proactively check if it uses reflection, JNI, or139 resources that need native image configuration140- Native build failures are often only caught by `make test-native`, not `make test` — always141 recommend running native tests when changes touch serialization, reflection, or new dependencies142- If a doc URL returns sparse content or a 404, use WebSearch as fallback to find the current page143- For Quarkus-specific native patterns (like `@RegisterForReflection`), prefer the Quarkus Native144 Tips guide — it's more practical than the GraalVM reference docs