javajlinkjpackage

What does the jlink option "--strip-native-commands" do?


I found nothing about --strip-native-commands using jlink --help (doesn't even list it as an option) or even in the docs. I have not found any documentation for it online, but using jpackage -h tells me:

--jlink-options <jlink options>
          A space separated list of options to pass to jlink
          If not specified, defaults to "--strip-native-commands
          --strip-debug --no-man-pages --no-header-files".
          This option can be used multiple times.
          ...
          ...
          If --runtime-image is not specified, jpackage will run jlink to
          create the runtime image using options:
          --strip-debug, --no-header-files, --no-man-pages, and
          --strip-native-commands.

There seems to be nothing about --strip-native-commands online. Using it seems to shrink the runtime a little bit:

34612   ncnotstripped
34568   ncstripped

But I want to be aware of any potential trade-offs. What does "native commands" refer to? What am I removing from my runtime to make it smaller?


Solution

  • Some options and documentation for jlink are "hidden" behind --list-plugins. If you execute:

    jlink --list-plugins
    

    You'll see:

     --strip-native-commands   Exclude native commands (such as java/java.exe)
                               from the image.
    

    At least in version 21.0.1 on Windows.