Version
- GraalVM for JDK 23 (Latest)
- GraalVM for JDK 24 (Early Access)
- GraalVM for JDK 21
- GraalVM for JDK 17
- Archives
- Dev Build
- Getting Started with Native Image
- Guides
- Native Image Basics
- Build Overview
- Reachability Metadata
- Optimizations and Performance
- Debugging and Diagnostics
- Dynamic Features
- Certificate Management
- Java Native Interface
- JCA Security Services
- URL Protocols
- Interoperability with Native Code
- LLVM Backend
- Workshops and Labs
Dynamic Features of Java
When you build a native image, it only includes the reachable elements starting from your application entry point, its dependent libraries, and the JDK classes discovered through a static analysis. However, the reachability of some elements may not be discoverable due to Java’s dynamic features including reflection, resource access, etc. If an element is not reachable, it will not be included in the generated binary and this can lead to run time failures.
Thus, some dynamic Java features may require special “treatment” such as a command line option or provisioning metadata to be compatible with ahead-of-time compilation using Native Image.
The reference information here explains how Native Image handles some dynamic features of Java: