JLINK(1)

πŸ“¦ version 27.0.1.0.3.u1, in arch rolling

okay bestie so this is from the JDK Commands manual set (it's jlink, section 1), and it's genuinely iconic β€” no cap πŸ’…

πŸŽ€ NAME πŸŽ€

jlink β€” assemble and optimize a set of modules and their dependencies into a custom runtime image. that's the whole vibe, we're building you your own runtime. main character energy fr πŸ¦‹

✨ SYNOPSIS ✨

jlink [options] --module-path modulepath --add-modules
module[,module...]
  • options β€” command-line options separated by spaces. see jlink Options below πŸ‘‡
  • modulepath β€” the path where the jlink tool discovers observable modules. these modules can be modular JAR files, JMOD files, or exploded modules 🫢
  • module β€” the names of the modules to add to the runtime image. the jlink tool adds these modules and their transitive dependencies.

πŸ’– DESCRIPTION πŸ’–

the jlink tool links a set of modules, along with their transitive dependences, to create a custom runtime image. it's giving "build-a-bear but for Java runtimes" 🧚

Note: Developers are responsible for updating their custom runtime images. yes that means you, bestie 😭 nobody's coming to update it for you.

  • --add-modules mod[,mod...] β€” adds the named modules, mod, to the default set of root modules. heads up: the default set of root modules is empty πŸ«₯
  • --bind-services β€” link service provider modules and their dependencies.
  • -c zip-{0-9} or --compress=zip-{0-9} β€” enable compression of resources. the accepted values are: zip-{0-9}, where zip-0 provides no compression, and zip-9 provides the best compression. default is zip-6. deprecated values to be removed in a future release:
    • 0: No compression. Use zip-0 instead.
    • 1: Constant string sharing
    • 2: ZIP. Use zip-6 instead.
  • --disable-plugin pluginname β€” disables the specified plug-in. see jlink Plug-ins for the list of supported plug-ins.
  • --endian {little|big} β€” specifies the byte order of the generated image. the default value is the format of your system's architecture.
  • -h or --help β€” prints the help message.
  • --ignore-signing-information β€” suppresses a fatal error when signed modular JARs are linked in the runtime image. the signature-related files of the signed modular JARs aren't copied to the runtime image. lowkey a "just ignore the drama" flag πŸ’€
  • --launcher command=module or --launcher command=module/main β€” specifies the launcher command name for the module or the command name for the module and main class. the module and the main class names are separated by a slash (/) ✨
  • --limit-modules mod[,mod...] β€” limits the universe of observable modules to those in the transitive closure of the named modules, mod, plus the main module, if any, plus any further modules specified in the --add-modules option.
  • --list-plugins β€” lists available plug-ins, which you can access through command-line options; see jlink Plug-ins.
  • -p or --module-path modulepath β€” specifies the module path. if this option is not specified, then the default module path is $JAVA_HOME/jmods. this directory contains the java.base module and the other standard and JDK modules. if this option is specified but the java.base module cannot be resolved from it, then the jlink command appends $JAVA_HOME/jmods to the module path 🫢
  • --no-header-files β€” excludes header files.
  • --no-man-pages β€” excludes man pages. (yes, irony, we know πŸ™ˆ)
  • --output path β€” specifies the location of the generated runtime image.
  • --save-opts filename β€” saves jlink options in the specified file.
  • --suggest-providers [name, ...] β€” suggest providers that implement the given service types from the module path.
  • --version β€” prints version information.
  • @filename β€” reads options from the specified file. an options file is a text file that contains the options and values that you would typically enter in a command prompt. options may appear on one line or on several lines. you may not specify environment variables for path names. you may comment out lines by prefixing a hash symbol (#) to the beginning of the line. the following is an example of an options file for the jlink command:
#Wed Dec 07 00:40:19 EST 2016
--module-path mlib
--add-modules com.greetings
--output greetingsapp

Note: Plug-ins not listed in this section aren't supported and are subject to change. so like… don't get attached to anything else, bestie πŸ’€

for plug-in options that require a pattern-list, the value is a comma-separated list of elements, with each element using one the following forms:

  • glob-pattern
  • glob:glob-pattern
  • regex:regex-pattern
  • @filename
    • filename is the name of a file that contains patterns to be used, one pattern per line.

for a complete list of all available plug-ins, run the command jlink --list-plugins πŸ‘‘

⭐ Plugin compress

Options

--compress=zip-{0-9}[:filter=pattern-list]

Description

compresses all resources in the output image. accepted values are: zip-{0-9}, where zip-0 provides no compression, and zip-9 provides the best compression. default is zip-6. deprecated values to be removed in a future release:

  • Level 0: No compression. Use zip-0 instead.
  • Level 1: Constant string sharing
  • Level 2: ZIP. Use zip-6 instead. an optional pattern-list filter can be specified to list the pattern of files to include.

⭐ Plugin include-locales

Options

--include-locales=langtag[,langtag]*

Description

includes the list of locales where langtag is a BCP 47 language tag. this option supports locale matching as defined in RFC 4647. ensure that you add the module jdk.localedata when using this option πŸ₯Ί (like, actually β€” it says ensure, so…)

Example:

--add-modules jdk.localedata --include-locales=en,ja,*-IN

⭐ Plugin order-resources

Options

--order-resources=pattern-list

Description

orders the specified paths in priority order. if @filename is specified, then each line in pattern-list must be an exact match for the paths to be ordered.

Example:

--order-resources=/module-info.class,@classlist,/java.base/java/lang/

⭐ Plugin strip-debug

Options

--strip-debug

Description

strips debug information from the output image. bye bye debug info, you won't be missed πŸ’…

⭐ Plugin generate-cds-archive

Options

--generate-cds-archive

Description

generate CDS archive if the runtime image supports the CDS feature.


this one creates a runtime image in the directory greetingsapp. it links the module com.greetings, whose module definition is contained in the directory mlib:

jlink --module-path mlib --add-modules com.greetings --output greetingsapp

this one lists the modules in the runtime image greetingsapp:

greetingsapp/bin/java --list-modules
com.greetings
java.base@11
java.logging@11
org.astro@1.0

this one creates a runtime image in the directory compressedrt that's stripped of debug symbols, uses compression to reduce space, and includes French language locale information:

jlink --add-modules jdk.localedata --strip-debug --compress=2 --include-locales=fr --output compressedrt

this one compares the size of the runtime image compressedrt with fr_rt, which isn't stripped of debug symbols and doesn't use compression:

jlink --add-modules jdk.localedata --include-locales=fr --output fr_rt

du -sh ./compressedrt ./fr_rt
23M     ./compressedrt
36M     ./fr_rt

this one lists the providers that implement java.security.Provider:

jlink --suggest-providers java.security.Provider

Suggested providers:
  java.naming provides java.security.Provider used by java.base
  java.security.jgss provides java.security.Provider used by java.base
  java.security.sasl provides java.security.Provider used by java.base
  java.smartcardio provides java.security.Provider used by java.base
  java.xml.crypto provides java.security.Provider used by java.base
  jdk.crypto.cryptoki provides java.security.Provider used by java.base
  jdk.security.jgss provides java.security.Provider used by java.base

this one creates a custom runtime image named mybuild that includes only java.naming and jdk.crypto.cryptoki and their dependencies but no other providers. note that these dependencies must exist in the module path:

jlink --add-modules java.naming,jdk.crypto.cryptoki --output mybuild

this one is similar to the one that creates a runtime image named greetingsapp, except that it will link the modules resolved from root modules with service binding; see the Configuration.resolveAndBind method:

jlink --module-path mlib --add-modules com.greetings --output greetingsapp --bind-services

and this one lists the modules in the runtime image greetingsapp created by that command (look at all these, she ate πŸ”₯):

greetingsapp/bin/java --list-modules
com.greetings
java.base@11
java.compiler@11
java.datatransfer@11
java.desktop@11
java.logging@11
java.management@11
java.management.rmi@11
java.naming@11
java.prefs@11
java.rmi@11
java.security.jgss@11
java.security.sasl@11
java.smartcardio@11
java.xml@11
java.xml.crypto@11
jdk.accessibility@11
jdk.charsets@11
jdk.compiler@11
jdk.crypto.cryptoki@11
jdk.crypto.ec@11
jdk.crypto.mscapi@11
jdk.internal.opt@11
jdk.jartool@11
jdk.javadoc@11
jdk.jdeps@11
jdk.jfr@11
jdk.jlink@11
jdk.localedata@11
jdk.management@11
jdk.management.jfr@11
jdk.naming.dns@11
jdk.naming.rmi@11
jdk.security.auth@11
jdk.security.jgss@11
jdk.zipfs@11
org.astro@1.0

that's the whole thing bestie, go build a tiny runtime and feel powerful πŸ«ΆπŸ’œ

this page is from JDK 27.0.1.0.3, dated 2026, and it lives at JLINK(1) in the manual β€” mwah, xoxo πŸ’‹

πŸ“¦ where this page comes from