- 22.2 Release
- 22.1 Release
- 22.0 Release
- 21.3 Release
- Dev Build
- Native Image
- How-to Guides
- Native Image Basics
- Build Overview
- Build Output
- Build Configuration
- Build Options
- Hosted and Runtime Options
- Reachability Metadata
- Optimizations and Performance
- Debugging and Diagnostics
- Dynamic Features
- Interoperability with Native Code
- LLVM Backend
- Workshops and Labs
Native Image Build Overview
The syntax of the
native-image command is:
native-image [options] <mainclass> [imagename] [options]to build a native binary from
<mainclass>class in the current working directory. The classpath may optionally be provided with the
-cp <classpath>option where
<classpath>is a colon-separated (on Windows, semicolon-separated) list of paths to directories and jars.
native-image [options] -jar jarfile [imagename] [options]to build native binary from a JAR file.
native-image [options] -m <module>/<mainClass> [imagename] [options]to build a native binary from a Java module.
The options passed to
native-image are evaluated from left to right.
The options fall into three categories:
- Image generation options - for the full list, run
- Macro options
- Non-standard options - subject to change through a deprecation cycle, run
native-image --help-extrafor the full list.
Find a complete list of options for the
native-image tool here.
Further Reading #
For more tweaks and how to properly configure the
native-image tool, see Build Configuration.
Native Image will output the progress and various statistics when building the native binary. To learn more about the output, and the different build phases, see Build Output.
If you are new to GraalVM Native Image or have little experience using it, see the Native Image Basics to better understand some key aspects before going further.