1 .\" Copyright (c) 1994, 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.3.1 23 .\" 24 .TH "JLINK" "1" "2018" "JDK 13" "JDK Commands" 25 .hy 26 .SH NAME 27 .PP 28 jlink \- assemble and optimize a set of modules and their dependencies 29 into a custom runtime image 30 .SH SYNOPSIS 31 .PP 32 \f[CB]jlink\f[R] [\f[I]options\f[R]] \f[CB]\-\-module\-path\f[R] 33 \f[I]modulepath\f[R] \f[CB]\-\-add\-modules\f[R] \f[I]module\f[R] [, 34 \f[I]module\f[R]...] 35 .TP 36 .B \f[I]options\f[R] 37 Command\-line options separated by spaces. 38 See \f[B]jlink Options\f[R]. 39 .RS 40 .RE 41 .TP 42 .B \f[I]modulepath\f[R] 43 The path where the \f[CB]jlink\f[R] tool discovers observable modules. 44 These modules can be modular JAR files, JMOD files, or exploded modules. 45 .RS 46 .RE 47 .TP 48 .B \f[I]module\f[R] 49 The names of the modules to add to the runtime image. 50 The \f[CB]jlink\f[R] tool adds these modules and their transitive 51 dependencies. 52 .RS 53 .RE 54 .SH DESCRIPTION 55 .PP 56 The \f[CB]jlink\f[R] tool links a set of modules, along with their 57 transitive dependences, to create a custom runtime image. 58 .PP 59 \f[B]Note:\f[R] 60 .PP 61 Developers are responsible for updating their custom runtime images. 62 .SH JLINK OPTIONS 63 .TP 64 .B \f[CB]\-\-add\-modules\f[R] \f[I]mod\f[R] [\f[CB],\f[R] \f[I]mod\f[R]...] 65 Adds the named modules, \f[I]mod\f[R], to the default set of root 66 modules. 67 The default set of root modules is empty. 68 .RS 69 .RE 70 .TP 71 .B \f[CB]\-\-bind\-services\f[R] 72 Link service provider modules and their dependencies. 73 .RS 74 .RE 75 .TP 76 .B \f[CB]\-c\ ={0|1|2}\f[R] or \f[CB]\-\-compress={0|1|2}\f[R] 77 Enable compression of resources: 78 .RS 79 .IP \[bu] 2 80 \f[CB]0\f[R]: No compression 81 .IP \[bu] 2 82 \f[CB]1\f[R]: Constant string sharing 83 .IP \[bu] 2 84 \f[CB]2\f[R]: ZIP 85 .RE 86 .TP 87 .B \f[CB]\-\-disable\-plugin\f[R] \f[I]pluginname\f[R] 88 Disables the specified plug\-in. 89 See \f[B]jlink Plug\-ins\f[R] for the list of supported plug\-ins. 90 .RS 91 .RE 92 .TP 93 .B \f[CB]\-\-endian\f[R] {\f[CB]little\f[R]|\f[CB]big\f[R]} 94 Specifies the byte order of the generated image. 95 The default value is the format of your system\[aq]s architecture. 96 .RS 97 .RE 98 .TP 99 .B \f[CB]\-h\f[R] or \f[CB]\-\-help\f[R] 100 Prints the help message. 101 .RS 102 .RE 103 .TP 104 .B \f[CB]\-\-ignore\-signing\-information\f[R] 105 Suppresses a fatal error when signed modular JARs are linked in the 106 runtime image. 107 The signature\-related files of the signed modular JARs aren\[aq]t 108 copied to the runtime image. 109 .RS 110 .RE 111 .TP 112 .B \f[CB]\-\-launcher\f[R] \f[I]command\f[R]\f[CB]=\f[R]\f[I]module\f[R] or \f[CB]\-\-launcher\f[R] \f[I]command\f[R]\f[CB]=\f[R]\f[I]module\f[R]\f[CB]/\f[R]\f[I]main\f[R] 113 Specifies the launcher command name for the module or the command name 114 for the module and main class (the module and the main class names are 115 separated by a slash (\f[CB]/\f[R])). 116 .RS 117 .RE 118 .TP 119 .B \f[CB]\-\-limit\-modules\f[R] \f[I]mod\f[R] [\f[CB],\f[R] \f[I]mod\f[R]...] 120 Limits the universe of observable modules to those in the transitive 121 closure of the named modules, \f[CB]mod\f[R], plus the main module, if 122 any, plus any further modules specified in the \f[CB]\-\-add\-modules\f[R] 123 option. 124 .RS 125 .RE 126 .TP 127 .B \f[CB]\-\-list\-plugins\f[R] 128 Lists available plug\-ins, which you can access through command\-line 129 options; see \f[B]jlink Plug\-ins\f[R]. 130 .RS 131 .RE 132 .TP 133 .B \f[CB]\-p\f[R] or \f[CB]\-\-module\-path\f[R] \f[I]modulepath\f[R] 134 Specifies the module path. 135 .RS 136 .PP 137 If this option is not specified, then the default module path is 138 \f[CB]$JAVA_HOME/jmods\f[R]. 139 This directory contains the \f[CB]java.base\f[R] module and the other 140 standard and JDK modules. 141 If this option is specified but the \f[CB]java.base\f[R] module cannot be 142 resolved from it, then the \f[CB]jlink\f[R] command appends 143 \f[CB]$JAVA_HOME/jmods\f[R] to the module path. 144 .RE 145 .TP 146 .B \f[CB]\-\-no\-header\-files\f[R] 147 Excludes header files. 148 .RS 149 .RE 150 .TP 151 .B \f[CB]\-\-no\-man\-pages\f[R] 152 Excludes man pages. 153 .RS 154 .RE 155 .TP 156 .B \f[CB]\-\-output\f[R] \f[I]path\f[R] 157 Specifies the location of the generated runtime image. 158 .RS 159 .RE 160 .TP 161 .B \f[CB]\-\-save\-opts\f[R] \f[I]filename\f[R] 162 Saves \f[CB]jlink\f[R] options in the specified file. 163 .RS 164 .RE 165 .TP 166 .B \f[CB]\-\-suggest\-providers\f[R] [\f[I]name\f[R]\f[CB],\f[R] ...] 167 Suggest providers that implement the given service types from the module 168 path. 169 .RS 170 .RE 171 .TP 172 .B \f[CB]\-\-version\f[R] 173 Prints version information. 174 .RS 175 .RE 176 .TP 177 .B \f[CB]\@\f[R]\f[I]filename\f[R] 178 Reads options from the specified file. 179 .RS 180 .PP 181 An options file is a text file that contains the options and values that 182 you would typically enter in a command prompt. 183 Options may appear on one line or on several lines. 184 You may not specify environment variables for path names. 185 You may comment out lines by prefixing a hash symbol (\f[CB]#\f[R]) to the 186 beginning of the line. 187 .PP 188 The following is an example of an options file for the \f[CB]jlink\f[R] 189 command: 190 .IP 191 .nf 192 \f[CB] 193 #Wed\ Dec\ 07\ 00:40:19\ EST\ 2016 194 \-\-module\-path\ mlib 195 \-\-add\-modules\ com.greetings 196 \-\-output\ greetingsapp 197 \f[R] 198 .fi 199 .RE 200 .SH JLINK PLUG\-INS 201 .PP 202 \f[B]Note:\f[R] 203 .PP 204 Plug\-ins not listed in this section aren\[aq]t supported and are 205 subject to change. 206 .PP 207 For plug\-in options that require a \f[I]pattern\-list\f[R], the value is 208 a comma\-separated list of elements, with each element using one the 209 following forms: 210 .IP \[bu] 2 211 \f[I]glob\-pattern\f[R] 212 .IP \[bu] 2 213 \f[CB]glob:\f[R]\f[I]glob\-pattern\f[R] 214 .IP \[bu] 2 215 \f[CB]regex:\f[R]\f[I]regex\-pattern\f[R] 216 .IP \[bu] 2 217 \f[CB]\@\f[R]\f[I]filename\f[R] 218 .RS 2 219 .IP \[bu] 2 220 \f[I]filename\f[R] is the name of a file that contains patterns to be 221 used, one pattern per line. 222 .RE 223 .PP 224 For a complete list of all available plug\-ins, run the command 225 \f[CB]jlink\ \-\-list\-plugins\f[R]. 226 .SS Plugin \f[CB]compress\f[R] 227 .TP 228 .B Options 229 \f[CB]\-\-compress=\f[R]{\f[CB]0\f[R]|\f[CB]1\f[R]|\f[CB]2\f[R]}[\f[CB]:filter=\f[R]\f[I]pattern\-list\f[R]] 230 .RS 231 .RE 232 .TP 233 .B Description 234 Compresses all resources in the output image. 235 .RS 236 .IP \[bu] 2 237 Level 0: No compression 238 .IP \[bu] 2 239 Level 1: Constant string sharing 240 .IP \[bu] 2 241 Level 2: ZIP 242 .PP 243 An optional \f[I]pattern\-list\f[R] filter can be specified to list the 244 pattern of files to include. 245 .RE 246 .SS Plugin \f[CB]include\-locales\f[R] 247 .TP 248 .B Options 249 \f[CB]\-\-include\-locales=\f[R]\f[I]langtag\f[R][\f[CB],\f[R]\f[I]langtag\f[R]]* 250 .RS 251 .RE 252 .TP 253 .B Description 254 Includes the list of locales where \f[I]langtag\f[R] is a BCP 47 language 255 tag. 256 This option supports locale matching as defined in RFC 4647. 257 Ensure that you add the module jdk.localedata when using this option. 258 .RS 259 .PP 260 Example: 261 .RS 262 .PP 263 \f[CB]\-\-add\-modules\ jdk.localedata\ \-\-include\-locales=en,ja,*\-IN\f[R] 264 .RE 265 .RE 266 .SS Plugin \f[CB]order\-resources\f[R] 267 .TP 268 .B Options 269 \f[CB]\-\-order\-resources=\f[R]\f[I]pattern\-list\f[R] 270 .RS 271 .RE 272 .TP 273 .B Description 274 Orders the specified paths in priority order. 275 If \f[CB]\@\f[R]\f[I]filename\f[R] is specified, then each line in 276 \f[I]pattern\-list\f[R] must be an exact match for the paths to be 277 ordered. 278 .RS 279 .PP 280 Example: 281 .RS 282 .PP 283 \f[CB]\-\-order\-resources=/module\-info.class,\@classlist,/java.base/java/lang/\f[R] 284 .RE 285 .RE 286 .SS Plugin \f[CB]strip\-debug\f[R] 287 .TP 288 .B Options 289 \f[CB]\-\-strip\-debug\f[R] 290 .RS 291 .RE 292 .TP 293 .B Description 294 Strips debug information from the output image. 295 .RS 296 .RE 297 .SH JLINK EXAMPLES 298 .PP 299 The following command creates a runtime image in the directory 300 \f[CB]greetingsapp\f[R]. 301 This command links the module \f[CB]com.greetings\f[R], whose module 302 definition is contained in the directory \f[CB]mlib\f[R]. 303 .IP 304 .nf 305 \f[CB] 306 jlink\ \-\-module\-path\ mlib\ \-\-add\-modules\ com.greetings\ \-\-output\ greetingsapp 307 \f[R] 308 .fi 309 .PP 310 The following command lists the modules in the runtime image 311 \f[CB]greetingsapp\f[R]: 312 .IP 313 .nf 314 \f[CB] 315 greetingsapp/bin/java\ \-\-list\-modules 316 com.greetings 317 java.base\@11 318 java.logging\@11 319 org.astro\@1.0 320 \f[R] 321 .fi 322 .PP 323 The following command creates a runtime image in the directory 324 compressedrt that\[aq]s stripped of debug symbols, uses compression to 325 reduce space, and includes French language locale information: 326 .IP 327 .nf 328 \f[CB] 329 jlink\ \-\-add\-modules\ jdk.localedata\ \-\-strip\-debug\ \-\-compress=2\ \-\-include\-locales=fr\ \-\-output\ compressedrt 330 \f[R] 331 .fi 332 .PP 333 The following example compares the size of the runtime image 334 \f[CB]compressedrt\f[R] with \f[CB]fr_rt\f[R], which isn\[aq]t stripped of 335 debug symbols and doesn\[aq]t use compression: 336 .IP 337 .nf 338 \f[CB] 339 jlink\ \-\-add\-modules\ jdk.localedata\ \-\-include\-locales=fr\ \-\-output\ fr_rt 340 341 du\ \-sh\ ./compressedrt\ ./fr_rt 342 23M\ \ \ \ \ ./compressedrt 343 36M\ \ \ \ \ ./fr_rt 344 \f[R] 345 .fi 346 .PP 347 The following example lists the providers that implement 348 \f[CB]java.security.Provider\f[R]: 349 .IP 350 .nf 351 \f[CB] 352 jlink\ \-\-suggest\-providers\ java.security.Provider 353 354 Suggested\ providers: 355 \ \ java.naming\ provides\ java.security.Provider\ used\ by\ java.base 356 \ \ java.security.jgss\ provides\ java.security.Provider\ used\ by\ java.base 357 \ \ java.security.sasl\ provides\ java.security.Provider\ used\ by\ java.base 358 \ \ java.smartcardio\ provides\ java.security.Provider\ used\ by\ java.base 359 \ \ java.xml.crypto\ provides\ java.security.Provider\ used\ by\ java.base 360 \ \ jdk.crypto.cryptoki\ provides\ java.security.Provider\ used\ by\ java.base 361 \ \ jdk.crypto.ec\ provides\ java.security.Provider\ used\ by\ java.base 362 \ \ jdk.crypto.mscapi\ provides\ java.security.Provider\ used\ by\ java.base 363 \ \ jdk.security.jgss\ provides\ java.security.Provider\ used\ by\ java.base 364 \f[R] 365 .fi 366 .PP 367 The following example creates a custom runtime image named 368 \f[CB]mybuild\f[R] that includes only \f[CB]java.naming\f[R] and 369 \f[CB]jdk.crypto.cryptoki\f[R] and their dependencies but no other 370 providers. 371 Note that these dependencies must exist in the module path: 372 .IP 373 .nf 374 \f[CB] 375 jlink\ \-\-add\-modules\ java.naming,jdk.crypto.cryptoki\ \-\-output\ mybuild 376 \f[R] 377 .fi 378 .PP 379 The following command is similar to the one that creates a runtime image 380 named \f[CB]greetingsapp\f[R], except that it will link the modules 381 resolved from root modules with service binding; see the 382 \f[B]\f[BC]Configuration.resolveAndBind\f[B]\f[R] 383 [https://docs.oracle.com/javase/10/docs/api/java/lang/module/Configuration.html#resolveAndBind\-java.lang.module.ModuleFinder\-java.util.List\-java.lang.module.ModuleFinder\-java.util.Collection\-] 384 method. 385 .IP 386 .nf 387 \f[CB] 388 jlink\ \-\-module\-path\ mlib\ \-\-add\-modules\ com.greetings\ \-\-output\ greetingsapp\ \-\-bind\-services 389 \f[R] 390 .fi 391 .PP 392 The following command lists the modules in the runtime image 393 greetingsapp created by this command: 394 .IP 395 .nf 396 \f[CB] 397 greetingsapp/bin/java\ \-\-list\-modules 398 com.greetings 399 java.base\@11 400 java.compiler\@11 401 java.datatransfer\@11 402 java.desktop\@11 403 java.logging\@11 404 java.management\@11 405 java.management.rmi\@11 406 java.naming\@11 407 java.prefs\@11 408 java.rmi\@11 409 java.security.jgss\@11 410 java.security.sasl\@11 411 java.smartcardio\@11 412 java.xml\@11 413 java.xml.crypto\@11 414 jdk.accessibility\@11 415 jdk.charsets\@11 416 jdk.compiler\@11 417 jdk.crypto.cryptoki\@11 418 jdk.crypto.ec\@11 419 jdk.crypto.mscapi\@11 420 jdk.internal.opt\@11 421 jdk.jartool\@11 422 jdk.javadoc\@11 423 jdk.jdeps\@11 424 jdk.jfr\@11 425 jdk.jlink\@11 426 jdk.localedata\@11 427 jdk.management\@11 428 jdk.management.jfr\@11 429 jdk.naming.dns\@11 430 jdk.naming.rmi\@11 431 jdk.security.auth\@11 432 jdk.security.jgss\@11 433 jdk.zipfs\@11 434 org.astro\@1.0 435 \f[R] 436 .fi