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
202 The following command creates a runtime image in the directory greet‐
203 ingsapp. This command links the module com.greetings, whose module
204 definition is contained in the directory mlib.
205
206 jlink --module-path mlib --add-modules com.greetings --output greetingsapp
207
208 The following command lists the modules in the runtime image greet‐
209 ingsapp:
210
211 greetingsapp/bin/java --list-modules
212 com.greetings
213 java.base@11
214 java.logging@11
215 org.astro@1.0
216
217 The following command creates a runtime image in the directory com‐
218 pressedrt that's stripped of debug symbols, uses compression to reduce
219 space, and includes French language locale information:
220
221 jlink --add-modules jdk.localedata --strip-debug --compress=2 --include-locales=fr --output compressedrt
222
223 The following example compares the size of the runtime image compresse‐
224 drt with fr_rt, which isn't stripped of debug symbols and doesn't use
225 compression:
226
227 jlink --add-modules jdk.localedata --include-locales=fr --output fr_rt
228
229 du -sh ./compressedrt ./fr_rt
230 23M ./compressedrt
231 36M ./fr_rt
232
233 The following example lists the providers that implement java.securi‐
234 ty.Provider:
235
236 jlink --suggest-providers java.security.Provider
237
238 Suggested providers:
239 java.naming provides java.security.Provider used by java.base
240 java.security.jgss provides java.security.Provider used by java.base
241 java.security.sasl provides java.security.Provider used by java.base
242 java.smartcardio provides java.security.Provider used by java.base
243 java.xml.crypto provides java.security.Provider used by java.base
244 jdk.crypto.cryptoki provides java.security.Provider used by java.base
245 jdk.crypto.ec provides java.security.Provider used by java.base
246 jdk.crypto.mscapi provides java.security.Provider used by java.base
247 jdk.security.jgss provides java.security.Provider used by java.base
248
249 The following example creates a custom runtime image named mybuild that
250 includes only java.naming and jdk.crypto.cryptoki and their dependen‐
251 cies but no other providers. Note that these dependencies must exist
252 in the module path:
253
254 jlink --add-modules java.naming,jdk.crypto.cryptoki --output mybuild
255
256 The following command is similar to the one that creates a runtime im‐
257 age named greetingsapp, except that it will link the modules resolved
258 from root modules with service binding; see the Configuration.resolve‐
259 AndBind method.
260
261 jlink --module-path mlib --add-modules com.greetings --output greetingsapp --bind-services
262
263 The following command lists the modules in the runtime image greet‐
264 ingsapp created by this command:
265
266 greetingsapp/bin/java --list-modules
267 com.greetings
268 java.base@11
269 java.compiler@11
270 java.datatransfer@11
271 java.desktop@11
272 java.logging@11
273 java.management@11
274 java.management.rmi@11
275 java.naming@11
276 java.prefs@11
277 java.rmi@11
278 java.security.jgss@11
279 java.security.sasl@11
280 java.smartcardio@11
281 java.xml@11
282 java.xml.crypto@11
283 jdk.accessibility@11
284 jdk.charsets@11
285 jdk.compiler@11
286 jdk.crypto.cryptoki@11
287 jdk.crypto.ec@11
288 jdk.crypto.mscapi@11
289 jdk.internal.opt@11
290 jdk.jartool@11
291 jdk.javadoc@11
292 jdk.jdeps@11
293 jdk.jfr@11
294 jdk.jlink@11
295 jdk.localedata@11
296 jdk.management@11
297 jdk.management.jfr@11
298 jdk.naming.dns@11
299 jdk.naming.rmi@11
300 jdk.security.auth@11
301 jdk.security.jgss@11
302 jdk.zipfs@11
303 org.astro@1.0
304
305
306
307JDK 16 2021 JLINK(1)