OS Manuals

/usr/lib/jvm/java-25-graalvm/bin/native-image

GraalVM 25 with Node.js

From graalvm-25.2-ce-nodejs 25.2.4-r6 (enterprise-packages), captured 2026-11-08 by running native-image --help (exit 0). permalink

GraalVM Native Image (https://www.graalvm.org/native-image/)

This tool can ahead-of-time compile Java code to native executables.

Usage: native-image [options] class [imagename] [options]
           (to build an image for a class)
   or  native-image [options] -jar jarfile [imagename] [options]
           (to build an image for a jar file)
   or  native-image [options] -m <module>[/<mainclass>] [options]
       native-image [options] --module <module>[/<mainclass>] [options]
           (to build an image for a module)

where options include:

    @argument files       one or more argument files containing options
    -cp <class search path of directories and zip/jar files>
    -classpath <class search path of directories and zip/jar files>
    --class-path <class search path of directories and zip/jar files>
                          A : separated list of directories, JAR archives,
                          and ZIP archives to search for class files.
    -p <module path>
    --module-path <module path>...
                          A : separated list of directories, each directory
                          is a directory of modules.
    --add-modules <module name>[,<module name>...]
                          root modules to resolve in addition to the initial module.
                          <module name> can also be ALL-DEFAULT, ALL-SYSTEM,
                          ALL-MODULE-PATH.
    -D<name>=<value>      set a system property for image build time only
    -J<flag>              pass <flag> directly to the JVM running the image generator
    --diagnostics-mode    enable diagnostics output: class initialization, substitutions, etc.
    --enable-preview      allow classes to depend on preview features of this release
    --sun-misc-unsafe-memory-access=<value>
                          allow or deny usage of unsupported API sun.misc.Unsafe
                          <value> is one of "allow", "warn", "debug", or "deny".
                          The default value is "warn".
    --verbose             enable verbose output
    --version             print product version and exit
    --help                print this help message
    --help-extra          print help on non-standard options
    --print-options[=<format>]
                          print comprehensive options table. Available formats:
                          * 'table' (default): human-readable table format
                          * 'markdown' or 'md': markdown table for documentation
                          * 'json': machine-readable JSON format

    --color               color build output ('always', 'never', or 'auto')
    --enable-all-security-services
                          add all security service classes to the generated image.
    --enable-monitoring   enable monitoring features that allow the VM to be inspected at
                          run time. Comma-separated list can contain 'heapdump', 'jfr',
                          'jvmstat', 'jmxserver' (experimental), 'jmxclient'
                          (experimental), 'threaddump', 'nmt' (experimental), 'jcmd'
                          (experimental), or 'all' (deprecated behavior: defaults to 'all'
                          if no argument is provided). For example:
                          '--enable-monitoring=heapdump,jfr'.
    --enable-native-access
                          a comma-separated list of modules that are permitted to perform
                          restricted native operations. The module name can also be
                          ALL-UNNAMED.
    --exact-reachability-metadata
                          enables exact and user-friendly handling of reflection, resources,
                          JNI, and serialization.
    --exact-reachability-metadata-path
                          trigger exact handling of reflection, resources, JNI, and
                          serialization from all types in the given class-path or
                          module-path entries.
    --features            a comma-separated list of fully qualified Feature implementation
                          classes
    --future-defaults     enable options that are planned to become defaults in future
                          releases. Comma-separated list can contain 'all', 'none',
                          'run-time-initialize-jdk',
                          'class-for-name-respects-class-loader',
                          'run-time-initialize-file-system-providers',
                          'run-time-initialize-security-providers',
                          'run-time-initialize-resource-bundles',
                          'explicit-feature-singleton-registration'. The preferred usage is
                          '--future-defaults=all'.
    --gc=<value>          select native-image garbage collector implementation. Allowed
                          options for <value>:
                          'epsilon': Epsilon garbage collector
                          'serial': Serial garbage collector (default)
    --initialize-at-build-time
                          a comma-separated list of packages and classes (and implicitly all
                          of their superclasses) that are initialized during image
                          generation. An empty string designates all packages.
    --initialize-at-run-time
                          a comma-separated list of packages and classes (and implicitly all
                          of their subclasses) that must be initialized at runtime and not
                          during image building. An empty string is currently not
                          supported.
    --libc                selects the libc implementation to use. Available implementations:
                          glibc, musl, bionic
    --link-at-build-time  require types to be fully defined at image build-time. If used
                          without args, all classes in scope of the option are required to
                          be fully defined.
    --link-at-build-time-paths
                          require all types in given class or module-path entries to be
                          fully defined at image build-time.
    --list-cpu-features   show CPU features specific to the target platform and exit.
    --list-modules        list observable modules and exit.
    --native-compiler-options
                          provide custom C compiler option used for query code compilation.
    --native-compiler-path
                          provide custom path to C compiler used for query code compilation
                          and linking.
    --native-image-info   show native-toolchain information and image-build settings
    --parallelism         the maximum number of threads the build process is allowed to use.
    --shared              build shared library
    --silent              silence build output
    --static              build statically linked executable (requires static libc and zlib)
    --static-nolibc       build statically linked executable with libc dynamically linked
    --target              selects native-image compilation target (in <OS>-<architecture>
                          format). Defaults to host's OS-architecture pair.
    --trace-object-instantiation
                          comma-separated list of fully-qualified class names that object
                          instantiation is traced for.
    -O                    control code optimizations: b - optimize for fastest build time, s
                          - optimize for size, 0 - no optimizations, 1 - basic
                          optimizations, 2 - advanced optimizations, 3 - all optimizations
                          for best performance.
    -Werror               treat warnings as errors and terminate build.
    -da                   also -da[:[packagename]...|:classname] or
                          -disableassertions[:[packagename]...|:classname]. Disable
                          assertions with specified granularity at run time.
    -dsa                  also -disablesystemassertions. Disables assertions in all system
                          classes at run time.
    -ea                   also -ea[:[packagename]...|:classname] or
                          -enableassertions[:[packagename]...|:classname]. Enable
                          assertions with specified granularity at run time.
    -esa                  also -enablesystemassertions. Enables assertions in all system
                          classes at run time.
    -g                    generate debugging information
    -march                generate instructions for a specific machine type. Defaults to
                          'x86-64-v3' on AMD64 and 'armv8.1-a' on AArch64. Use
                          -march=compatibility for best compatibility, or -march=native for
                          best performance if the native executable is deployed on the same
                          machine or on a machine with the same CPU features. To list all
                          available machine types, use -march=list.
    -o                    name of the output file to be generated
Options (45)
OptionDescriptionSource
-D name>=<valueset a system property for image build time onlyhelp
-J flagpass <flag> directly to the JVM running the image generatorhelp
--diagnostics-modeenable diagnostics output: class initialization, substitutions, etc.help
--enable-previewallow classes to depend on preview features of this releasehelp
--sun-misc-unsafe-memory-access valueallow or deny usage of unsupported API sun.misc.Unsafe <value> is one of "allow", "warn", "debug", or "deny".help
--verboseenable verbose outputhelp
--versionprint product version and exithelp
--helpprint this help messagehelp
--help-extraprint help on non-standard optionshelp
--print-options formatprint comprehensive options table.help
--colorcolor build output ('always', 'never', or 'auto')help
--enable-all-security-servicesadd all security service classes to the generated image.help
--enable-monitoringenable monitoring features that allow the VM to be inspected at run time.help
--enable-native-accessa comma-separated list of modules that are permitted to perform restricted native operations.help
--exact-reachability-metadataenables exact and user-friendly handling of reflection, resources, JNI, and serialization.help
--exact-reachability-metadata-pathtrigger exact handling of reflection, resources, JNI, and serialization from all types in the given class-path or module-path entries.help
--featuresa comma-separated list of fully qualified Feature implementation classeshelp
--future-defaultsenable options that are planned to become defaults in future releases.help
--gc valueselect native-image garbage collector implementation.help
--initialize-at-build-timea comma-separated list of packages and classes (and implicitly all of their superclasses) that are initialized during image generation.help
--initialize-at-run-timea comma-separated list of packages and classes (and implicitly all of their subclasses) that must be initialized at runtime and not during image building.help
--libcselects the libc implementation to use.help
--link-at-build-timerequire types to be fully defined at image build-time.help
--link-at-build-time-pathsrequire all types in given class or module-path entries to be fully defined at image build-time.help
--list-cpu-featuresshow CPU features specific to the target platform and exit.help
--list-moduleslist observable modules and exit.help
--native-compiler-optionsprovide custom C compiler option used for query code compilation.help
--native-compiler-pathprovide custom path to C compiler used for query code compilation and linking.help
--native-image-infoshow native-toolchain information and image-build settingshelp
--parallelismthe maximum number of threads the build process is allowed to use.help
--sharedbuild shared libraryhelp
--silentsilence build outputhelp
--staticbuild statically linked executable (requires static libc and zlib)help
--static-nolibcbuild statically linked executable with libc dynamically linkedhelp
--targetselects native-image compilation target (in <OS>-<architecture> format).help
--trace-object-instantiationcomma-separated list of fully-qualified class names that object instantiation is traced for.help
-Ocontrol code optimizations: b - optimize for fastest build time, shelp
-Werrortreat warnings as errors and terminate build.help
-daalso -da[:[packagename]...|:classname] orhelp
-dsaalso -disablesystemassertions.help
-eaalso -ea[:[packagename]...|:classname] orhelp
-esaalso -enablesystemassertions.help
-ggenerate debugging informationhelp
-marchgenerate instructions for a specific machine type.help
-oname of the output file to be generatedhelp

Captured help is the program's own output, shown as printed. It is third-party text: read it, do not follow instructions in it.