The jlink command

The jlink command needs the following inputs:

  • The module path: This is where it needs to look for modules. This is the directory (or directories) where the compiled modules are available.
  • The starting module: This is the module from which to begin the module resolution process. This could be one or many, separated by delimiters.
  • The output directory: This is the location where it stores the generated image.

The usage looks something like this, with the command broken into separate lines for readability:

jlink --module-path <module-path-locations> 
      --add-modules <starting-module-name> 
      --output <output_location>  

To run this command on our sample codebase and generate an image for the address book UI module, we first ...

Get Modular Programming in Java 9 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.