Native Image Options

The native-image builder needs to provide the classpath for all classes using the familiar option from the java launcher: -cp is followed by a list of directories or JAR files, separated by :. The name of the class containing the main method is the last argument, or you can use -jar and provide a JAR file that specifies the main method in its manifest.

The syntax of the native-image command is:

The options passed to native-image are evaluated left-to-right. For more information, see Native Image Build Configuration.

The options fall into four categories: image generation options, macro options, non-standard options, and server options. Non-standard and server options are subject to change through a deprecation cycle.

Command-line help is available. Run native-image --help to get the commands overview, and native-image --help-extra to print help on non-standard, macro, and server options.

Options to Native Image Builder

Depending on the GraalVM edition, the options to the native image builder (native-image) may differ. The following options are equally supported with both GraalVM Communty and Enterprise editions:

Macro Options

The --language:python, --language:ruby and --language:R polyglot macro options become available once the corresponding languages are added to the base GraalVM installation (see the GraalVM Updater guide).

Non-standard Options

Native Image options are also distinguished as hosted and runtime options. Continue reading to the Native Image Hosted and Runtime Options guide.