1JLINK(1) JDK Commands JLINK(1)
2
3
4
6 jlink - assemble and optimize a set of modules and their dependencies
7 into a custom runtime image
8
10 jlink [options] --module-path modulepath --add-modules module [, mod‐
11 ule...]
12
13 options
14 Command-line options separated by spaces. See jlink Options.
15
16 modulepath
17 The path where the jlink tool discovers observable modules.
18 These modules can be modular JAR files, JMOD files, or exploded
19 modules.
20
21 module The names of the modules to add to the runtime image. The jlink
22 tool adds these modules and their transitive dependencies.
23
25 The jlink tool links a set of modules, along with their transitive de‐
26 pendences, to create a custom runtime image.
27
28 Note:
29
30 Developers are responsible for updating their custom runtime images.
31
33 --add-modules mod [, mod...]
34 Adds the named modules, mod, to the default set of root modules.
35 The default set of root modules is empty.
36
37 --bind-services
38 Link service provider modules and their dependencies.
39
40 -c ={0|1|2} or --compress={0|1|2}
41 Enable compression of resources:
42
43 • 0: No compression
44
45 • 1: Constant string sharing
46
47 • 2: ZIP
48
49 --disable-plugin pluginname
50 Disables the specified plug-in. See jlink Plug-ins for the list
51 of supported plug-ins.
52
53 --endian {little|big}
54 Specifies the byte order of the generated image. The default
55 value is the format of your system's architecture.
56
57 -h or --help
58 Prints the help message.
59
60 --ignore-signing-information
61 Suppresses a fatal error when signed modular JARs are linked in
62 the runtime image. The signature-related files of the signed
63 modular JARs aren't copied to the runtime image.
64
65 --launcher command=module or --launcher command=module/main
66 Specifies the launcher command name for the module or the com‐
67 mand name for the module and main class (the module and the main
68 class names are separated by a slash (/)).
69
70 --limit-modules mod [, mod...]
71 Limits the universe of observable modules to those in the tran‐
72 sitive closure of the named modules, mod, plus the main module,
73 if any, plus any further modules specified in the --add-modules
74 option.
75
76 --list-plugins
77 Lists available plug-ins, which you can access through com‐
78 mand-line options; see jlink Plug-ins.
79
80 -p or --module-path modulepath
81 Specifies the module path.
82
83 If this option is not specified, then the default module path is
84 $JAVA_HOME/jmods. This directory contains the java.base module
85 and the other standard and JDK modules. If this option is spec‐
86 ified but the java.base module cannot be resolved from it, then
87 the jlink command appends $JAVA_HOME/jmods to the module path.
88
89 --no-header-files
90 Excludes header files.
91
92 --no-man-pages
93 Excludes man pages.
94
95 --output path
96 Specifies the location of the generated runtime image.
97
98 --save-opts filename
99 Saves jlink options in the specified file.
100
101 --suggest-providers [name, ...]
102 Suggest providers that implement the given service types from
103 the module path.
104
105 --version
106 Prints version information.
107
108 @filename
109 Reads options from the specified file.
110
111 An options file is a text file that contains the options and
112 values that you would typically enter in a command prompt. Op‐
113 tions may appear on one line or on several lines. You may not
114 specify environment variables for path names. You may comment
115 out lines by prefixing a hash symbol (#) to the beginning of the
116 line.
117
118 The following is an example of an options file for the jlink
119 command:
120
121 #Wed Dec 07 00:40:19 EST 2016
122 --module-path mlib
123 --add-modules com.greetings
124 --output greetingsapp
125
127 Note:
128
129 Plug-ins not listed in this section aren't supported and are subject to
130 change.
131
132 For plug-in options that require a pattern-list, the value is a com‐
133 ma-separated list of elements, with each element using one the follow‐
134 ing forms:
135
136 • glob-pattern
137
138 • glob:glob-pattern
139
140 • regex:regex-pattern
141
142 • @filename
143
144 • filename is the name of a file that contains patterns to be used,
145 one pattern per line.
146
147 For a complete list of all available plug-ins, run the command
148 jlink --list-plugins.
149
150 Plugin compress
151 Options
152 --compress={0|1|2}[:filter=pattern-list]
153
154 Description
155 Compresses all resources in the output image.
156
157 • Level 0: No compression
158
159 • Level 1: Constant string sharing
160
161 • Level 2: ZIP
162
163 An optional pattern-list filter can be specified to list the
164 pattern of files to include.
165
166 Plugin include-locales
167 Options
168 --include-locales=langtag[,langtag]*
169
170 Description
171 Includes the list of locales where langtag is a BCP 47 language
172 tag. This option supports locale matching as defined in RFC
173 4647. Ensure that you add the module jdk.localedata when using
174 this option.
175
176 Example:
177
178 --add-modules jdk.localedata --include-locales=en,ja,*-IN
179
180 Plugin order-resources
181 Options
182 --order-resources=pattern-list
183
184 Description
185 Orders the specified paths in priority order. If @filename is
186 specified, then each line in pattern-list must be an exact match
187 for the paths to be ordered.
188
189 Example:
190
191 --order-resources=/module-info.class,@classlist,/ja‐
192 va.base/java/lang/
193
194 Plugin strip-debug
195 Options
196 --strip-debug
197
198 Description
199 Strips debug information from the output image.
200
201 Plugin generate-cds-archive
202 Options
203 --generate-cds-archive
204
205 Description
206 Generate CDS archive if the runtime image supports the CDS fea‐
207 ture.
208
210 The following command creates a runtime image in the directory greet‐
211 ingsapp. This command links the module com.greetings, whose module
212 definition is contained in the directory mlib.
213
214 jlink --module-path mlib --add-modules com.greetings --output greetingsapp
215
216 The following command lists the modules in the runtime image greet‐
217 ingsapp:
218
219 greetingsapp/bin/java --list-modules
220 com.greetings
221 java.base@11
222 java.logging@11
223 org.astro@1.0
224
225 The following command creates a runtime image in the directory com‐
226 pressedrt that's stripped of debug symbols, uses compression to reduce
227 space, and includes French language locale information:
228
229 jlink --add-modules jdk.localedata --strip-debug --compress=2 --include-locales=fr --output compressedrt
230
231 The following example compares the size of the runtime image compresse‐
232 drt with fr_rt, which isn't stripped of debug symbols and doesn't use
233 compression:
234
235 jlink --add-modules jdk.localedata --include-locales=fr --output fr_rt
236
237 du -sh ./compressedrt ./fr_rt
238 23M ./compressedrt
239 36M ./fr_rt
240
241 The following example lists the providers that implement java.securi‐
242 ty.Provider:
243
244 jlink --suggest-providers java.security.Provider
245
246 Suggested providers:
247 java.naming provides java.security.Provider used by java.base
248 java.security.jgss provides java.security.Provider used by java.base
249 java.security.sasl provides java.security.Provider used by java.base
250 java.smartcardio provides java.security.Provider used by java.base
251 java.xml.crypto provides java.security.Provider used by java.base
252 jdk.crypto.cryptoki provides java.security.Provider used by java.base
253 jdk.crypto.ec provides java.security.Provider used by java.base
254 jdk.crypto.mscapi provides java.security.Provider used by java.base
255 jdk.security.jgss provides java.security.Provider used by java.base
256
257 The following example creates a custom runtime image named mybuild that
258 includes only java.naming and jdk.crypto.cryptoki and their dependen‐
259 cies but no other providers. Note that these dependencies must exist
260 in the module path:
261
262 jlink --add-modules java.naming,jdk.crypto.cryptoki --output mybuild
263
264 The following command is similar to the one that creates a runtime im‐
265 age named greetingsapp, except that it will link the modules resolved
266 from root modules with service binding; see the Configuration.resolve‐
267 AndBind method.
268
269 jlink --module-path mlib --add-modules com.greetings --output greetingsapp --bind-services
270
271 The following command lists the modules in the runtime image greet‐
272 ingsapp created by this command:
273
274 greetingsapp/bin/java --list-modules
275 com.greetings
276 java.base@11
277 java.compiler@11
278 java.datatransfer@11
279 java.desktop@11
280 java.logging@11
281 java.management@11
282 java.management.rmi@11
283 java.naming@11
284 java.prefs@11
285 java.rmi@11
286 java.security.jgss@11
287 java.security.sasl@11
288 java.smartcardio@11
289 java.xml@11
290 java.xml.crypto@11
291 jdk.accessibility@11
292 jdk.charsets@11
293 jdk.compiler@11
294 jdk.crypto.cryptoki@11
295 jdk.crypto.ec@11
296 jdk.crypto.mscapi@11
297 jdk.internal.opt@11
298 jdk.jartool@11
299 jdk.javadoc@11
300 jdk.jdeps@11
301 jdk.jfr@11
302 jdk.jlink@11
303 jdk.localedata@11
304 jdk.management@11
305 jdk.management.jfr@11
306 jdk.naming.dns@11
307 jdk.naming.rmi@11
308 jdk.security.auth@11
309 jdk.security.jgss@11
310 jdk.zipfs@11
311 org.astro@1.0
312
313
314
315JDK 19 2022 JLINK(1)