1
.\" Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
2
.\" DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
.\" This code is free software; you can redistribute it and/or modify it
5
.\" under the terms of the GNU General Public License version 2 only, as
6
.\" published by the Free Software Foundation.
8
.\" This code is distributed in the hope that it will be useful, but WITHOUT
9
.\" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10
.\" FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
11
.\" version 2 for more details (a copy is included in the LICENSE file that
12
.\" accompanied this code).
14
.\" You should have received a copy of the GNU General Public License version
15
.\" 2 along with this work; if not, write to the Free Software Foundation,
16
.\" Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18
.\" Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
19
.\" or visit www.oracle.com if you need additional information or have any
22
.\" Automatically generated by Pandoc 2.19.2
24
.\" Define V font for inline verbatim, using C font in formats
25
.\" that render this, and otherwise B font.
26
.ie "\f[CB]x\f[R]"x" \{\
38
.TH "JLINK" "1" "2025" "JDK 24-ea" "JDK Commands"
42
jlink - assemble and optimize a set of modules and their dependencies
43
into a custom runtime image
46
\f[V]jlink\f[R] [\f[I]options\f[R]] \f[V]--module-path\f[R]
47
\f[I]modulepath\f[R] \f[V]--add-modules\f[R]
48
\f[I]module\f[R][,\f[I]module\f[R]...]
51
Command-line options separated by spaces.
52
See \f[B]jlink Options\f[R].
55
The path where the \f[V]jlink\f[R] tool discovers observable modules.
56
These modules can be modular JAR files, JMOD files, or exploded modules.
59
The names of the modules to add to the runtime image.
60
The \f[V]jlink\f[R] tool adds these modules and their transitive
64
The \f[V]jlink\f[R] tool links a set of modules, along with their
65
transitive dependences, to create a custom runtime image.
69
Developers are responsible for updating their custom runtime images.
72
\f[V]--add-modules\f[R] \f[I]mod\f[R][\f[V],\f[R]\f[I]mod\f[R]...]
73
Adds the named modules, \f[I]mod\f[R], to the default set of root
75
The default set of root modules is empty.
77
\f[V]--bind-services\f[R]
78
Link service provider modules and their dependencies.
80
\f[V]-c ={0|1|2}\f[R] or \f[V]--compress={0|1|2}\f[R]
81
Enable compression of resources:
84
\f[V]0\f[R]: No compression
86
\f[V]1\f[R]: Constant string sharing
91
\f[V]--disable-plugin\f[R] \f[I]pluginname\f[R]
92
Disables the specified plug-in.
93
See \f[B]jlink Plug-ins\f[R] for the list of supported plug-ins.
95
\f[V]--endian\f[R] {\f[V]little\f[R]|\f[V]big\f[R]}
96
Specifies the byte order of the generated image.
97
The default value is the format of your system\[aq]s architecture.
99
\f[V]-h\f[R] or \f[V]--help\f[R]
100
Prints the help message.
102
\f[V]--ignore-signing-information\f[R]
103
Suppresses a fatal error when signed modular JARs are linked in the
105
The signature-related files of the signed modular JARs aren\[aq]t copied
108
\f[V]--launcher\f[R] \f[I]command\f[R]\f[V]=\f[R]\f[I]module\f[R] or \f[V]--launcher\f[R] \f[I]command\f[R]\f[V]=\f[R]\f[I]module\f[R]\f[V]/\f[R]\f[I]main\f[R]
109
Specifies the launcher command name for the module or the command name
110
for the module and main class (the module and the main class names are
111
separated by a slash (\f[V]/\f[R])).
113
\f[V]--limit-modules\f[R] \f[I]mod\f[R][\f[V],\f[R]\f[I]mod\f[R]...]
114
Limits the universe of observable modules to those in the transitive
115
closure of the named modules, \f[V]mod\f[R], plus the main module, if
116
any, plus any further modules specified in the \f[V]--add-modules\f[R]
119
\f[V]--list-plugins\f[R]
120
Lists available plug-ins, which you can access through command-line
121
options; see \f[B]jlink Plug-ins\f[R].
123
\f[V]-p\f[R] or \f[V]--module-path\f[R] \f[I]modulepath\f[R]
124
Specifies the module path.
127
If this option is not specified, then the default module path is
128
\f[V]$JAVA_HOME/jmods\f[R].
129
This directory contains the \f[V]java.base\f[R] module and the other
130
standard and JDK modules.
131
If this option is specified but the \f[V]java.base\f[R] module cannot be
132
resolved from it, then the \f[V]jlink\f[R] command appends
133
\f[V]$JAVA_HOME/jmods\f[R] to the module path.
136
\f[V]--no-header-files\f[R]
137
Excludes header files.
139
\f[V]--no-man-pages\f[R]
142
\f[V]--output\f[R] \f[I]path\f[R]
143
Specifies the location of the generated runtime image.
145
\f[V]--save-opts\f[R] \f[I]filename\f[R]
146
Saves \f[V]jlink\f[R] options in the specified file.
148
\f[V]--suggest-providers\f[R] [\f[I]name\f[R]\f[V],\f[R] ...]
149
Suggest providers that implement the given service types from the module
153
Prints version information.
155
\f[V]\[at]\f[R]\f[I]filename\f[R]
156
Reads options from the specified file.
159
An options file is a text file that contains the options and values that
160
you would typically enter in a command prompt.
161
Options may appear on one line or on several lines.
162
You may not specify environment variables for path names.
163
You may comment out lines by prefixing a hash symbol (\f[V]#\f[R]) to
164
the beginning of the line.
166
The following is an example of an options file for the \f[V]jlink\f[R]
171
#Wed Dec 07 00:40:19 EST 2016
173
--add-modules com.greetings
182
Plug-ins not listed in this section aren\[aq]t supported and are subject
185
For plug-in options that require a \f[I]pattern-list\f[R], the value is
186
a comma-separated list of elements, with each element using one the
189
\f[I]glob-pattern\f[R]
191
\f[V]glob:\f[R]\f[I]glob-pattern\f[R]
193
\f[V]regex:\f[R]\f[I]regex-pattern\f[R]
195
\f[V]\[at]\f[R]\f[I]filename\f[R]
198
\f[I]filename\f[R] is the name of a file that contains patterns to be
199
used, one pattern per line.
202
For a complete list of all available plug-ins, run the command
203
\f[V]jlink --list-plugins\f[R].
204
.SS Plugin \f[V]compress\f[R]
207
\f[V]--compress=\f[R]{\f[V]0\f[R]|\f[V]1\f[R]|\f[V]2\f[R]}[\f[V]:filter=\f[R]\f[I]pattern-list\f[R]]
210
Compresses all resources in the output image.
213
Level 0: No compression
215
Level 1: Constant string sharing
219
An optional \f[I]pattern-list\f[R] filter can be specified to list the
220
pattern of files to include.
222
.SS Plugin \f[V]include-locales\f[R]
225
\f[V]--include-locales=\f[R]\f[I]langtag\f[R][\f[V],\f[R]\f[I]langtag\f[R]]*
228
Includes the list of locales where \f[I]langtag\f[R] is a BCP 47
230
This option supports locale matching as defined in RFC 4647.
231
Ensure that you add the module jdk.localedata when using this option.
237
\f[V]--add-modules jdk.localedata --include-locales=en,ja,*-IN\f[R]
240
.SS Plugin \f[V]order-resources\f[R]
243
\f[V]--order-resources=\f[R]\f[I]pattern-list\f[R]
246
Orders the specified paths in priority order.
247
If \f[V]\[at]\f[R]\f[I]filename\f[R] is specified, then each line in
248
\f[I]pattern-list\f[R] must be an exact match for the paths to be
255
\f[V]--order-resources=/module-info.class,\[at]classlist,/java.base/java/lang/\f[R]
258
.SS Plugin \f[V]strip-debug\f[R]
261
\f[V]--strip-debug\f[R]
264
Strips debug information from the output image.
265
.SS Plugin \f[V]generate-cds-archive\f[R]
268
\f[V]--generate-cds-archive\f[R]
271
Generate CDS archive if the runtime image supports the CDS feature.
274
The following command creates a runtime image in the directory
275
\f[V]greetingsapp\f[R].
276
This command links the module \f[V]com.greetings\f[R], whose module
277
definition is contained in the directory \f[V]mlib\f[R].
281
jlink --module-path mlib --add-modules com.greetings --output greetingsapp
285
The following command lists the modules in the runtime image
286
\f[V]greetingsapp\f[R]:
290
greetingsapp/bin/java --list-modules
298
The following command creates a runtime image in the directory
299
compressedrt that\[aq]s stripped of debug symbols, uses compression to
300
reduce space, and includes French language locale information:
304
jlink --add-modules jdk.localedata --strip-debug --compress=2 --include-locales=fr --output compressedrt
308
The following example compares the size of the runtime image
309
\f[V]compressedrt\f[R] with \f[V]fr_rt\f[R], which isn\[aq]t stripped of
310
debug symbols and doesn\[aq]t use compression:
314
jlink --add-modules jdk.localedata --include-locales=fr --output fr_rt
316
du -sh ./compressedrt ./fr_rt
322
The following example lists the providers that implement
323
\f[V]java.security.Provider\f[R]:
327
jlink --suggest-providers java.security.Provider
330
java.naming provides java.security.Provider used by java.base
331
java.security.jgss provides java.security.Provider used by java.base
332
java.security.sasl provides java.security.Provider used by java.base
333
java.smartcardio provides java.security.Provider used by java.base
334
java.xml.crypto provides java.security.Provider used by java.base
335
jdk.crypto.cryptoki provides java.security.Provider used by java.base
336
jdk.crypto.ec provides java.security.Provider used by java.base
337
jdk.crypto.mscapi provides java.security.Provider used by java.base
338
jdk.security.jgss provides java.security.Provider used by java.base
342
The following example creates a custom runtime image named
343
\f[V]mybuild\f[R] that includes only \f[V]java.naming\f[R] and
344
\f[V]jdk.crypto.cryptoki\f[R] and their dependencies but no other
346
Note that these dependencies must exist in the module path:
350
jlink --add-modules java.naming,jdk.crypto.cryptoki --output mybuild
354
The following command is similar to the one that creates a runtime image
355
named \f[V]greetingsapp\f[R], except that it will link the modules
356
resolved from root modules with service binding; see the
357
\f[B]\f[VB]Configuration.resolveAndBind\f[B]\f[R] method.
361
jlink --module-path mlib --add-modules com.greetings --output greetingsapp --bind-services
365
The following command lists the modules in the runtime image
366
greetingsapp created by this command:
370
greetingsapp/bin/java --list-modules
374
java.datatransfer\[at]11
377
java.management\[at]11
378
java.management.rmi\[at]11
382
java.security.jgss\[at]11
383
java.security.sasl\[at]11
384
java.smartcardio\[at]11
386
java.xml.crypto\[at]11
387
jdk.accessibility\[at]11
390
jdk.crypto.cryptoki\[at]11
392
jdk.crypto.mscapi\[at]11
393
jdk.internal.opt\[at]11
401
jdk.management.jfr\[at]11
404
jdk.security.auth\[at]11
405
jdk.security.jgss\[at]11