JDK14/Java14源码在线阅读

.\" Copyright (c) 1994, 2019, Oracle and/or its affiliates. All rights reserved.
.\" DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
.\"
.\" This code is free software; you can redistribute it and/or modify it
.\" under the terms of the GNU General Public License version 2 only, as
.\" published by the Free Software Foundation.
.\"
.\" This code is distributed in the hope that it will be useful, but WITHOUT
.\" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
.\" FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
.\" version 2 for more details (a copy is included in the LICENSE file that
.\" accompanied this code).
.\"
.\" You should have received a copy of the GNU General Public License version
.\" 2 along with this work; if not, write to the Free Software Foundation,
.\" Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
.\"
.\" Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
.\" or visit www.oracle.com if you need additional information or have any
.\" questions.
.\"
.\" Automatically generated by Pandoc 2.3.1
.\"
.TH "JLINK" "1" "2020" "JDK 14" "JDK Commands"
.hy
.SH NAME
.PP
jlink \- assemble and optimize a set of modules and their dependencies
into a custom runtime image
.SH SYNOPSIS
.PP
\f[CB]jlink\f[R] [\f[I]options\f[R]] \f[CB]\-\-module\-path\f[R]
\f[I]modulepath\f[R] \f[CB]\-\-add\-modules\f[R] \f[I]module\f[R] [,
\f[I]module\f[R]...]
.TP
.B \f[I]options\f[R]
Command\-line options separated by spaces.
See \f[B]jlink Options\f[R].
.RS
.RE
.TP
.B \f[I]modulepath\f[R]
The path where the \f[CB]jlink\f[R] tool discovers observable modules.
These modules can be modular JAR files, JMOD files, or exploded modules.
.RS
.RE
.TP
.B \f[I]module\f[R]
The names of the modules to add to the runtime image.
The \f[CB]jlink\f[R] tool adds these modules and their transitive
dependencies.
.RS
.RE
.SH DESCRIPTION
.PP
The \f[CB]jlink\f[R] tool links a set of modules, along with their
transitive dependences, to create a custom runtime image.
.PP
\f[B]Note:\f[R]
.PP
Developers are responsible for updating their custom runtime images.
.SH JLINK OPTIONS
.TP
.B \f[CB]\-\-add\-modules\f[R] \f[I]mod\f[R] [\f[CB],\f[R] \f[I]mod\f[R]...]
Adds the named modules, \f[I]mod\f[R], to the default set of root
modules.
The default set of root modules is empty.
.RS
.RE
.TP
.B \f[CB]\-\-bind\-services\f[R]
Link service provider modules and their dependencies.
.RS
.RE
.TP
.B \f[CB]\-c\ ={0|1|2}\f[R] or \f[CB]\-\-compress={0|1|2}\f[R]
Enable compression of resources:
.RS
.IP \[bu] 2
\f[CB]0\f[R]: No compression
.IP \[bu] 2
\f[CB]1\f[R]: Constant string sharing
.IP \[bu] 2
\f[CB]2\f[R]: ZIP
.RE
.TP
.B \f[CB]\-\-disable\-plugin\f[R] \f[I]pluginname\f[R]
Disables the specified plug\-in.
See \f[B]jlink Plug\-ins\f[R] for the list of supported plug\-ins.
.RS
.RE
.TP
.B \f[CB]\-\-endian\f[R] {\f[CB]little\f[R]|\f[CB]big\f[R]}
Specifies the byte order of the generated image.
The default value is the format of your system\[aq]s architecture.
.RS
.RE
.TP
.B \f[CB]\-h\f[R] or \f[CB]\-\-help\f[R]
Prints the help message.
.RS
.RE
.TP
.B \f[CB]\-\-ignore\-signing\-information\f[R]
Suppresses a fatal error when signed modular JARs are linked in the
runtime image.
The signature\-related files of the signed modular JARs aren\[aq]t
copied to the runtime image.
.RS
.RE
.TP
.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]
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 (\f[CB]/\f[R])).
.RS
.RE
.TP
.B \f[CB]\-\-limit\-modules\f[R] \f[I]mod\f[R] [\f[CB],\f[R] \f[I]mod\f[R]...]
Limits the universe of observable modules to those in the transitive
closure of the named modules, \f[CB]mod\f[R], plus the main module, if
any, plus any further modules specified in the \f[CB]\-\-add\-modules\f[R]
option.
.RS
.RE
.TP
.B \f[CB]\-\-list\-plugins\f[R]
Lists available plug\-ins, which you can access through command\-line
options; see \f[B]jlink Plug\-ins\f[R].
.RS
.RE
.TP
.B \f[CB]\-p\f[R] or \f[CB]\-\-module\-path\f[R] \f[I]modulepath\f[R]
Specifies the module path.
.RS
.PP
If this option is not specified, then the default module path is
\f[CB]$JAVA_HOME/jmods\f[R].
This directory contains the \f[CB]java.base\f[R] module and the other
standard and JDK modules.
If this option is specified but the \f[CB]java.base\f[R] module cannot be
resolved from it, then the \f[CB]jlink\f[R] command appends
\f[CB]$JAVA_HOME/jmods\f[R] to the module path.
.RE
.TP
.B \f[CB]\-\-no\-header\-files\f[R]
Excludes header files.
.RS
.RE
.TP
.B \f[CB]\-\-no\-man\-pages\f[R]
Excludes man pages.
.RS
.RE
.TP
.B \f[CB]\-\-output\f[R] \f[I]path\f[R]
Specifies the location of the generated runtime image.
.RS
.RE
.TP
.B \f[CB]\-\-save\-opts\f[R] \f[I]filename\f[R]
Saves \f[CB]jlink\f[R] options in the specified file.
.RS
.RE
.TP
.B \f[CB]\-\-suggest\-providers\f[R] [\f[I]name\f[R]\f[CB],\f[R] ...]
Suggest providers that implement the given service types from the module
path.
.RS
.RE
.TP
.B \f[CB]\-\-version\f[R]
Prints version information.
.RS
.RE
.TP
.B \f[CB]\@\f[R]\f[I]filename\f[R]
Reads options from the specified file.
.RS
.PP
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 (\f[CB]#\f[R]) to the
beginning of the line.
.PP
The following is an example of an options file for the \f[CB]jlink\f[R]
command:
.IP
.nf
\f[CB]
#Wed\ Dec\ 07\ 00:40:19\ EST\ 2016
\-\-module\-path\ mlib
\-\-add\-modules\ com.greetings
\-\-output\ greetingsapp
\f[R]
.fi
.RE
.SH JLINK PLUG\-INS
.PP
\f[B]Note:\f[R]
.PP
Plug\-ins not listed in this section aren\[aq]t supported and are
subject to change.
.PP
For plug\-in options that require a \f[I]pattern\-list\f[R], the value is
a comma\-separated list of elements, with each element using one the
following forms:
.IP \[bu] 2
\f[I]glob\-pattern\f[R]
.IP \[bu] 2
\f[CB]glob:\f[R]\f[I]glob\-pattern\f[R]
.IP \[bu] 2
\f[CB]regex:\f[R]\f[I]regex\-pattern\f[R]
.IP \[bu] 2
\f[CB]\@\f[R]\f[I]filename\f[R]
.RS 2
.IP \[bu] 2
\f[I]filename\f[R] is the name of a file that contains patterns to be
used, one pattern per line.
.RE
.PP
For a complete list of all available plug\-ins, run the command
\f[CB]jlink\ \-\-list\-plugins\f[R].
.SS Plugin \f[CB]compress\f[R]
.TP
.B Options
\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]]
.RS
.RE
.TP
.B Description
Compresses all resources in the output image.
.RS
.IP \[bu] 2
Level 0: No compression
.IP \[bu] 2
Level 1: Constant string sharing
.IP \[bu] 2
Level 2: ZIP
.PP
An optional \f[I]pattern\-list\f[R] filter can be specified to list the
pattern of files to include.
.RE
.SS Plugin \f[CB]include\-locales\f[R]
.TP
.B Options
\f[CB]\-\-include\-locales=\f[R]\f[I]langtag\f[R][\f[CB],\f[R]\f[I]langtag\f[R]]*
.RS
.RE
.TP
.B Description
Includes the list of locales where \f[I]langtag\f[R] 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.
.RS
.PP
Example:
.RS
.PP
\f[CB]\-\-add\-modules\ jdk.localedata\ \-\-include\-locales=en,ja,*\-IN\f[R]
.RE
.RE
.SS Plugin \f[CB]order\-resources\f[R]
.TP
.B Options
\f[CB]\-\-order\-resources=\f[R]\f[I]pattern\-list\f[R]
.RS
.RE
.TP
.B Description
Orders the specified paths in priority order.
If \f[CB]\@\f[R]\f[I]filename\f[R] is specified, then each line in
\f[I]pattern\-list\f[R] must be an exact match for the paths to be
ordered.
.RS
.PP
Example:
.RS
.PP
\f[CB]\-\-order\-resources=/module\-info.class,\@classlist,/java.base/java/lang/\f[R]
.RE
.RE
.SS Plugin \f[CB]strip\-debug\f[R]
.TP
.B Options
\f[CB]\-\-strip\-debug\f[R]
.RS
.RE
.TP
.B Description
Strips debug information from the output image.
.RS
.RE
.SH JLINK EXAMPLES
.PP
The following command creates a runtime image in the directory
\f[CB]greetingsapp\f[R].
This command links the module \f[CB]com.greetings\f[R], whose module
definition is contained in the directory \f[CB]mlib\f[R].
.IP
.nf
\f[CB]
jlink\ \-\-module\-path\ mlib\ \-\-add\-modules\ com.greetings\ \-\-output\ greetingsapp
\f[R]
.fi
.PP
The following command lists the modules in the runtime image
\f[CB]greetingsapp\f[R]:
.IP
.nf
\f[CB]
greetingsapp/bin/java\ \-\-list\-modules
com.greetings
java.base\@11
java.logging\@11
org.astro\@1.0
\f[R]
.fi
.PP
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:
.IP
.nf
\f[CB]
jlink\ \-\-add\-modules\ jdk.localedata\ \-\-strip\-debug\ \-\-compress=2\ \-\-include\-locales=fr\ \-\-output\ compressedrt
\f[R]
.fi
.PP
The following example compares the size of the runtime image
\f[CB]compressedrt\f[R] with \f[CB]fr_rt\f[R], which isn\[aq]t stripped of
debug symbols and doesn\[aq]t use compression:
.IP
.nf
\f[CB]
jlink\ \-\-add\-modules\ jdk.localedata\ \-\-include\-locales=fr\ \-\-output\ fr_rt

du\ \-sh\ ./compressedrt\ ./fr_rt
23M\ \ \ \ \ ./compressedrt
36M\ \ \ \ \ ./fr_rt
\f[R]
.fi
.PP
The following example lists the providers that implement
\f[CB]java.security.Provider\f[R]:
.IP
.nf
\f[CB]
jlink\ \-\-suggest\-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
\f[R]
.fi
.PP
The following example creates a custom runtime image named
\f[CB]mybuild\f[R] that includes only \f[CB]java.naming\f[R] and
\f[CB]jdk.crypto.cryptoki\f[R] and their dependencies but no other
providers.
Note that these dependencies must exist in the module path:
.IP
.nf
\f[CB]
jlink\ \-\-add\-modules\ java.naming,jdk.crypto.cryptoki\ \-\-output\ mybuild
\f[R]
.fi
.PP

/**代码未完, 请加载全部代码(NowJava.com).**/
展开阅读全文

关注时代Java

关注时代Java