jdk

Форк
0
409 строк · 11.6 Кб
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.
3
.\"
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.
7
.\"
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).
13
.\"
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.
17
.\"
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
20
.\" questions.
21
.\"
22
.\" Automatically generated by Pandoc 2.19.2
23
.\"
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" \{\
27
. ftr V B
28
. ftr VI BI
29
. ftr VB B
30
. ftr VBI BI
31
.\}
32
.el \{\
33
. ftr V CR
34
. ftr VI CI
35
. ftr VB CB
36
. ftr VBI CBI
37
.\}
38
.TH "JLINK" "1" "2025" "JDK 24-ea" "JDK Commands"
39
.hy
40
.SH NAME
41
.PP
42
jlink - assemble and optimize a set of modules and their dependencies
43
into a custom runtime image
44
.SH SYNOPSIS
45
.PP
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]...]
49
.TP
50
\f[I]options\f[R]
51
Command-line options separated by spaces.
52
See \f[B]jlink Options\f[R].
53
.TP
54
\f[I]modulepath\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.
57
.TP
58
\f[I]module\f[R]
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
61
dependencies.
62
.SH DESCRIPTION
63
.PP
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.
66
.PP
67
\f[B]Note:\f[R]
68
.PP
69
Developers are responsible for updating their custom runtime images.
70
.SH JLINK OPTIONS
71
.TP
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
74
modules.
75
The default set of root modules is empty.
76
.TP
77
\f[V]--bind-services\f[R]
78
Link service provider modules and their dependencies.
79
.TP
80
\f[V]-c ={0|1|2}\f[R] or \f[V]--compress={0|1|2}\f[R]
81
Enable compression of resources:
82
.RS
83
.IP \[bu] 2
84
\f[V]0\f[R]: No compression
85
.IP \[bu] 2
86
\f[V]1\f[R]: Constant string sharing
87
.IP \[bu] 2
88
\f[V]2\f[R]: ZIP
89
.RE
90
.TP
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.
94
.TP
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.
98
.TP
99
\f[V]-h\f[R] or \f[V]--help\f[R]
100
Prints the help message.
101
.TP
102
\f[V]--ignore-signing-information\f[R]
103
Suppresses a fatal error when signed modular JARs are linked in the
104
runtime image.
105
The signature-related files of the signed modular JARs aren\[aq]t copied
106
to the runtime image.
107
.TP
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])).
112
.TP
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]
117
option.
118
.TP
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].
122
.TP
123
\f[V]-p\f[R] or \f[V]--module-path\f[R] \f[I]modulepath\f[R]
124
Specifies the module path.
125
.RS
126
.PP
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.
134
.RE
135
.TP
136
\f[V]--no-header-files\f[R]
137
Excludes header files.
138
.TP
139
\f[V]--no-man-pages\f[R]
140
Excludes man pages.
141
.TP
142
\f[V]--output\f[R] \f[I]path\f[R]
143
Specifies the location of the generated runtime image.
144
.TP
145
\f[V]--save-opts\f[R] \f[I]filename\f[R]
146
Saves \f[V]jlink\f[R] options in the specified file.
147
.TP
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
150
path.
151
.TP
152
\f[V]--version\f[R]
153
Prints version information.
154
.TP
155
\f[V]\[at]\f[R]\f[I]filename\f[R]
156
Reads options from the specified file.
157
.RS
158
.PP
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.
165
.PP
166
The following is an example of an options file for the \f[V]jlink\f[R]
167
command:
168
.IP
169
.nf
170
\f[CB]
171
#Wed Dec 07 00:40:19 EST 2016
172
--module-path mlib
173
--add-modules com.greetings
174
--output greetingsapp
175
\f[R]
176
.fi
177
.RE
178
.SH JLINK PLUG-INS
179
.PP
180
\f[B]Note:\f[R]
181
.PP
182
Plug-ins not listed in this section aren\[aq]t supported and are subject
183
to change.
184
.PP
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
187
following forms:
188
.IP \[bu] 2
189
\f[I]glob-pattern\f[R]
190
.IP \[bu] 2
191
\f[V]glob:\f[R]\f[I]glob-pattern\f[R]
192
.IP \[bu] 2
193
\f[V]regex:\f[R]\f[I]regex-pattern\f[R]
194
.IP \[bu] 2
195
\f[V]\[at]\f[R]\f[I]filename\f[R]
196
.RS 2
197
.IP \[bu] 2
198
\f[I]filename\f[R] is the name of a file that contains patterns to be
199
used, one pattern per line.
200
.RE
201
.PP
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]
205
.TP
206
Options
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]]
208
.TP
209
Description
210
Compresses all resources in the output image.
211
.RS
212
.IP \[bu] 2
213
Level 0: No compression
214
.IP \[bu] 2
215
Level 1: Constant string sharing
216
.IP \[bu] 2
217
Level 2: ZIP
218
.PP
219
An optional \f[I]pattern-list\f[R] filter can be specified to list the
220
pattern of files to include.
221
.RE
222
.SS Plugin \f[V]include-locales\f[R]
223
.TP
224
Options
225
\f[V]--include-locales=\f[R]\f[I]langtag\f[R][\f[V],\f[R]\f[I]langtag\f[R]]*
226
.TP
227
Description
228
Includes the list of locales where \f[I]langtag\f[R] is a BCP 47
229
language tag.
230
This option supports locale matching as defined in RFC 4647.
231
Ensure that you add the module jdk.localedata when using this option.
232
.RS
233
.PP
234
Example:
235
.RS
236
.PP
237
\f[V]--add-modules jdk.localedata --include-locales=en,ja,*-IN\f[R]
238
.RE
239
.RE
240
.SS Plugin \f[V]order-resources\f[R]
241
.TP
242
Options
243
\f[V]--order-resources=\f[R]\f[I]pattern-list\f[R]
244
.TP
245
Description
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
249
ordered.
250
.RS
251
.PP
252
Example:
253
.RS
254
.PP
255
\f[V]--order-resources=/module-info.class,\[at]classlist,/java.base/java/lang/\f[R]
256
.RE
257
.RE
258
.SS Plugin \f[V]strip-debug\f[R]
259
.TP
260
Options
261
\f[V]--strip-debug\f[R]
262
.TP
263
Description
264
Strips debug information from the output image.
265
.SS Plugin \f[V]generate-cds-archive\f[R]
266
.TP
267
Options
268
\f[V]--generate-cds-archive\f[R]
269
.TP
270
Description
271
Generate CDS archive if the runtime image supports the CDS feature.
272
.SH JLINK EXAMPLES
273
.PP
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].
278
.IP
279
.nf
280
\f[CB]
281
jlink --module-path mlib --add-modules com.greetings --output greetingsapp
282
\f[R]
283
.fi
284
.PP
285
The following command lists the modules in the runtime image
286
\f[V]greetingsapp\f[R]:
287
.IP
288
.nf
289
\f[CB]
290
greetingsapp/bin/java --list-modules
291
com.greetings
292
java.base\[at]11
293
java.logging\[at]11
294
org.astro\[at]1.0
295
\f[R]
296
.fi
297
.PP
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:
301
.IP
302
.nf
303
\f[CB]
304
jlink --add-modules jdk.localedata --strip-debug --compress=2 --include-locales=fr --output compressedrt
305
\f[R]
306
.fi
307
.PP
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:
311
.IP
312
.nf
313
\f[CB]
314
jlink --add-modules jdk.localedata --include-locales=fr --output fr_rt
315

316
du -sh ./compressedrt ./fr_rt
317
23M     ./compressedrt
318
36M     ./fr_rt
319
\f[R]
320
.fi
321
.PP
322
The following example lists the providers that implement
323
\f[V]java.security.Provider\f[R]:
324
.IP
325
.nf
326
\f[CB]
327
jlink --suggest-providers java.security.Provider
328

329
Suggested providers:
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
339
\f[R]
340
.fi
341
.PP
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
345
providers.
346
Note that these dependencies must exist in the module path:
347
.IP
348
.nf
349
\f[CB]
350
jlink --add-modules java.naming,jdk.crypto.cryptoki --output mybuild
351
\f[R]
352
.fi
353
.PP
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.
358
.IP
359
.nf
360
\f[CB]
361
jlink --module-path mlib --add-modules com.greetings --output greetingsapp --bind-services
362
\f[R]
363
.fi
364
.PP
365
The following command lists the modules in the runtime image
366
greetingsapp created by this command:
367
.IP
368
.nf
369
\f[CB]
370
greetingsapp/bin/java --list-modules
371
com.greetings
372
java.base\[at]11
373
java.compiler\[at]11
374
java.datatransfer\[at]11
375
java.desktop\[at]11
376
java.logging\[at]11
377
java.management\[at]11
378
java.management.rmi\[at]11
379
java.naming\[at]11
380
java.prefs\[at]11
381
java.rmi\[at]11
382
java.security.jgss\[at]11
383
java.security.sasl\[at]11
384
java.smartcardio\[at]11
385
java.xml\[at]11
386
java.xml.crypto\[at]11
387
jdk.accessibility\[at]11
388
jdk.charsets\[at]11
389
jdk.compiler\[at]11
390
jdk.crypto.cryptoki\[at]11
391
jdk.crypto.ec\[at]11
392
jdk.crypto.mscapi\[at]11
393
jdk.internal.opt\[at]11
394
jdk.jartool\[at]11
395
jdk.javadoc\[at]11
396
jdk.jdeps\[at]11
397
jdk.jfr\[at]11
398
jdk.jlink\[at]11
399
jdk.localedata\[at]11
400
jdk.management\[at]11
401
jdk.management.jfr\[at]11
402
jdk.naming.dns\[at]11
403
jdk.naming.rmi\[at]11
404
jdk.security.auth\[at]11
405
jdk.security.jgss\[at]11
406
jdk.zipfs\[at]11
407
org.astro\[at]1.0
408
\f[R]
409
.fi
410

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.