JLINK
Section: JDK Commands (1)
Updated: 2023
Index
Return to Main Contents
NAME
jlink- assemble and optimize a set of modules and their dependencies
into a custom runtime image
SYNOPSIS
V]jlinkR] [I]optionsR]] V-modul-pathR]
I]modulepathR] V-ad-modulesR] I]moduleR] [,
I]moduleR]...]
- I]optionsR]
-
Comman-line options separated by spaces.
See B]jlink OptionsR].
- I]modulepathR]
-
The path where the V]jlinkR] tool discovers observable modules.
These modules can be modular JAR files, JMOD files, or exploded modules.
- I]moduleR]
-
The names of the modules to add to the runtime image.
The V]jlinkR] tool adds these modules and their transitive
dependencies.
DESCRIPTION
The V]jlinkR] tool links a set of modules, along with their
transitive dependences, to create a custom runtime image.
B]Note:R]
Developers are responsible for updating their custom runtime images.
JLINK OPTIONS
- V-ad-modulesR] I]modR] [V],R] I]modR]...]
-
Adds the named modules, I]modR], to the default set of root
modules.
The default set of root modules is empty.
- V-bin-servicesR]
-
Link service provider modules and their dependencies.
- V-c ={0|1|2}R] or V-compress={0|1|2}R]
-
Enable compression of resources:
-
- [bu]
-
V]0R]: No compression
- [bu]
-
V]1R]: Constant string sharing
- [bu]
-
V]2R]: ZIP
- V-disabl-pluginR] I]pluginnameR]
-
Disables the specified plu-in.
See B]jlink Plu-insR] for the list of supported plu-ins.
- V-endianR] {V]littleR]|V]bigR]}
-
Specifies the byte order of the generated image.
The default value is the format of your system[aq]s architecture.
- V-hR] or V-helpR]
-
Prints the help message.
- V-ignor-signin-informationR]
-
Suppresses a fatal error when signed modular JARs are linked in the
runtime image.
The signatur-related files of the signed modular JARs aren[aq]t copied
to the runtime image.
- V-launcherR] I]commandR]V]=R]I]moduleR] or V-launcherR] I]commandR]V]=R]I]moduleR]V]/R]I]mainR]
-
Specifies the launcher command name for the module or the command name
for the module and main class (the module and the main class names are
separated by a slash (V]/R])).
- V-limi-modulesR] I]modR] [V],R] I]modR]...]
-
Limits the universe of observable modules to those in the transitive
closure of the named modules, V]modR], plus the main module, if
any, plus any further modules specified in the V-ad-modulesR]
option.
- V-lis-pluginsR]
-
Lists available plu-ins, which you can access through comman-line
options; see B]jlink Plu-insR].
- V-pR] or V-modul-pathR] I]modulepathR]
-
Specifies the module path.
-
If this option is not specified, then the default module path is
V]$JAVA_HOME/jmodsR].
This directory contains the V]java.baseR] module and the other
standard and JDK modules.
If this option is specified but the V]java.baseR] module cannot be
resolved from it, then the V]jlinkR] command appends
V]$JAVA_HOME/jmodsR] to the module path.
- V-n-heade-filesR]
-
Excludes header files.
- V-n-ma-pagesR]
-
Excludes man pages.
- V-outputR] I]pathR]
-
Specifies the location of the generated runtime image.
- V-sav-optsR] I]filenameR]
-
Saves V]jlinkR] options in the specified file.
- V-sugges-providersR] [I]nameR]V],R] ...]
-
Suggest providers that implement the given service types from the module
path.
- V-versionR]
-
Prints version information.
- V][at]R]I]filenameR]
-
Reads options from the specified file.
-
An options file is a text file that contains the options and values that
you would typically enter in a command prompt.
Options may appear on one line or on several lines.
You may not specify environment variables for path names.
You may comment out lines by prefixing a hash symbol (V]#R]) to
the beginning of the line.
The following is an example of an options file for the V]jlinkR]
command:
-
CB]
#Wed Dec 07 00:40:19 EST 2016-modul-path mlib-ad-modules com.greetings-output greetingsapp
R]
JLINK PLU-INS
B]Note:R]
Plu-ins not listed in this section aren[aq]t supported and are subject
to change.
For plu-in options that require a I]patter-listR], the value is
a comm-separated list of elements, with each element using one the
following forms:
- [bu]
-
I]glo-patternR]
- [bu]
-
V]glob:R]I]glo-patternR]
- [bu]
-
V]regex:R]I]rege-patternR]
- [bu]
-
V][at]R]I]filenameR]
-
- [bu]
-
I]filenameR] is the name of a file that contains patterns to be
used, one pattern per line.
For a complete list of all available plu-ins, run the command
V]jlink-lis-pluginsR].
Plugin V]compressR]
- Options
-
V-compress=R]{V]0R]|V]1R]|V]2R]}[V]:filter=R]I]patter-listR]]
- Description
-
Compresses all resources in the output image.
-
- [bu]
-
Level 0: No compression
- [bu]
-
Level 1: Constant string sharing
- [bu]
-
Level 2: ZIP
An optional I]patter-listR] filter can be specified to list the
pattern of files to include.
Plugin V]includ-localesR]
- Options
-
V-includ-locales=R]I]langtagR][V],R]I]langtagR]]*
- Description
-
Includes the list of locales where I]langtagR] is a BCP 47
language tag.
This option supports locale matching as defined in RFC 4647.
Ensure that you add the module jdk.localedata when using this option.
-
Example:
-
V-ad-modules jdk.localedata-includ-locales=en,ja,-INR]
Plugin V]orde-resourcesR]
- Options
-
V-orde-resources=R]I]patter-listR]
- Description
-
Orders the specified paths in priority order.
If V][at]R]I]filenameR] is specified, then each line in
I]patter-listR] must be an exact match for the paths to be
ordered.
-
Example:
-
V-orde-resources=/modul-info.class,[at]classlist,/java.base/java/lang/R]
Plugin V]stri-debugR]
- Options
-
V-stri-debugR]
- Description
-
Strips debug information from the output image.
Plugin V]generat-cd-archiveR]
- Options
-
V-generat-cd-archiveR]
- Description
-
Generate CDS archive if the runtime image supports the CDS feature.
JLINK EXAMPLES
The following command creates a runtime image in the directory
V]greetingsappR].
This command links the module V]com.greetingsR], whose module
definition is contained in the directory V]mlibR].
-
CB]
jlink-modul-path mlib-ad-modules com.greetings-output greetingsapp
R]
The following command lists the modules in the runtime image
V]greetingsappR]:
-
CB]
greetingsapp/bin/java-lis-modules
com.greetings
java.base[at]11
java.logging[at]11
org.astro[at]1.0
R]
The following command creates a runtime image in the directory
compressedrt that[aq]s stripped of debug symbols, uses compression to
reduce space, and includes French language locale information:
-
CB]
jlink-ad-modules jdk.localedata-stri-debug-compress=2-includ-locales=fr-output compressedrt
R]
The following example compares the size of the runtime image
V]compressedrtR] with V]fr_rtR], which isn[aq]t stripped of
debug symbols and doesn[aq]t use compression:
-
CB]
jlink-ad-modules jdk.localedata-includ-locales=fr-output fr_rt
du-sh ./compressedrt ./fr_rt
23M ./compressedrt
36M ./fr_rt
R]
The following example lists the providers that implement
V]java.security.ProviderR]:
-
CB]
jlink-sugges-providers java.security.Provider
Suggested providers:
java.naming provides java.security.Provider used by java.base
java.security.jgss provides java.security.Provider used by java.base
java.security.sasl provides java.security.Provider used by java.base
java.smartcardio provides java.security.Provider used by java.base
java.xml.crypto provides java.security.Provider used by java.base
jdk.crypto.cryptoki provides java.security.Provider used by java.base
jdk.crypto.ec provides java.security.Provider used by java.base
jdk.crypto.mscapi provides java.security.Provider used by java.base
jdk.security.jgss provides java.security.Provider used by java.base
R]
The following example creates a custom runtime image named
V]mybuildR] that includes only V]java.namingR] and
V]jdk.crypto.cryptokiR] and their dependencies but no other
providers.
Note that these dependencies must exist in the module path:
-
CB]
jlink-ad-modules java.naming,jdk.crypto.cryptoki-output mybuild
R]
The following command is similar to the one that creates a runtime image
named V]greetingsappR], except that it will link the modules
resolved from root modules with service binding; see the
B]VB]Configuration.resolveAndBindB]R] method.
-
CB]
jlink-modul-path mlib-ad-modules com.greetings-output greetingsapp-bin-services
R]
The following command lists the modules in the runtime image
greetingsapp created by this command:
-
CB]
greetingsapp/bin/java-lis-modules
com.greetings
java.base[at]11
java.compiler[at]11
java.datatransfer[at]11
java.desktop[at]11
java.logging[at]11
java.management[at]11
java.management.rmi[at]11
java.naming[at]11
java.prefs[at]11
java.rmi[at]11
java.security.jgss[at]11
java.security.sasl[at]11
java.smartcardio[at]11
java.xml[at]11
java.xml.crypto[at]11
jdk.accessibility[at]11
jdk.charsets[at]11
jdk.compiler[at]11
jdk.crypto.cryptoki[at]11
jdk.crypto.ec[at]11
jdk.crypto.mscapi[at]11
jdk.internal.opt[at]11
jdk.jartool[at]11
jdk.javadoc[at]11
jdk.jdeps[at]11
jdk.jfr[at]11
jdk.jlink[at]11
jdk.localedata[at]11
jdk.management[at]11
jdk.management.jfr[at]11
jdk.naming.dns[at]11
jdk.naming.rmi[at]11
jdk.security.auth[at]11
jdk.security.jgss[at]11
jdk.zipfs[at]11
org.astro[at]1.0
R]
Index
- NAME
-
- SYNOPSIS
-
- DESCRIPTION
-
- JLINK OPTIONS
-
- JLINK PLUG-INS
-
- Plugin V]compressR]
-
- Plugin V]include-localesR]
-
- Plugin V]order-resourcesR]
-
- Plugin V]strip-debugR]
-
- Plugin V]generate-cds-archiveR]
-
- JLINK EXAMPLES
-