8344056: Use markdown format for man pages

Reviewed-by: cstein, iris, dholmes
This commit is contained in:
Magnus Ihse Bursie 2024-11-18 09:23:50 +00:00
parent 6c2ae44c05
commit 475feb064b
66 changed files with 18886 additions and 22510 deletions

View File

@ -178,10 +178,8 @@ ifeq ($(call isTargetOsType, unix)+$(MAKEFILE_PREFIX), true+Launcher)
# We assume all our man pages should reside in section 1. # We assume all our man pages should reside in section 1.
MAN_FILES_MD := $(wildcard $(addsuffix /*.md, $(call FindModuleManDirs, $(MODULE)))) MAN_FILES_MD := $(wildcard $(addsuffix /*.md, $(call FindModuleManDirs, $(MODULE))))
MAN_FILES_TROFF := $(wildcard $(addsuffix /*.1, $(call FindModuleManDirs, $(MODULE))))
ifneq ($(MAN_FILES_MD), ) ifneq ($(MAN_FILES_MD), )
# If we got markdown files, ignore the troff files
ifeq ($(ENABLE_PANDOC), false) ifeq ($(ENABLE_PANDOC), false)
$(info Warning: pandoc not found. Not generating man pages) $(info Warning: pandoc not found. Not generating man pages)
else else
@ -226,13 +224,5 @@ ifeq ($(call isTargetOsType, unix)+$(MAKEFILE_PREFIX), true+Launcher)
TARGETS += $(BUILD_MAN_PAGES) TARGETS += $(BUILD_MAN_PAGES)
endif endif
else
# No markdown man pages present
$(eval $(call SetupCopyFiles, COPY_MAN_PAGES, \
DEST := $(SUPPORT_OUTPUTDIR)/modules_man/$(MODULE)/man1, \
FILES := $(MAN_FILES_TROFF), \
))
TARGETS += $(COPY_MAN_PAGES)
endif endif
endif endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,100 +0,0 @@
.\" Copyright (c) 1997, 2018, 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.19.2
.\"
.\" Define V font for inline verbatim, using C font in formats
.\" that render this, and otherwise B font.
.ie "\f[CB]x\f[R]"x" \{\
. ftr V B
. ftr VI BI
. ftr VB B
. ftr VBI BI
.\}
.el \{\
. ftr V CR
. ftr VI CI
. ftr VB CB
. ftr VBI CBI
.\}
.TH "RMIREGISTRY" "1" "2025" "JDK 24-ea" "JDK Commands"
.hy
.SH NAME
.PP
rmiregistry - create and start a remote object registry on the specified
port on the current host
.SH SYNOPSIS
.PP
\f[V]rmiregistry\f[R] [\f[I]options\f[R]] [\f[I]port\f[R]]
.TP
\f[I]options\f[R]
This represents the option for the \f[V]rmiregistry\f[R] command.
See \f[B]Options\f[R]
.TP
\f[I]port\f[R]
The number of a port on the current host at which to start the remote
object registry.
.SH DESCRIPTION
.PP
The \f[V]rmiregistry\f[R] command creates and starts a remote object
registry on the specified port on the current host.
If the port is omitted, then the registry is started on port 1099.
The \f[V]rmiregistry\f[R] command produces no output and is typically
run in the background, for example:
.RS
.PP
\f[V]rmiregistry &\f[R]
.RE
.PP
A remote object registry is a bootstrap naming service that\[aq]s used
by RMI servers on the same host to bind remote objects to names.
Clients on local and remote hosts can then look up remote objects and
make remote method invocations.
.PP
The registry is typically used to locate the first remote object on
which an application needs to call methods.
That object then provides application-specific support for finding other
objects.
.PP
The methods of the \f[V]java.rmi.registry.LocateRegistry\f[R] class are
used to get a registry operating on the local host or local host and
port.
.PP
The URL-based methods of the \f[V]java.rmi.Naming\f[R] class operate on
a registry and can be used to:
.IP \[bu] 2
Bind the specified name to a remote object
.IP \[bu] 2
Return an array of the names bound in the registry
.IP \[bu] 2
Return a reference, a stub, for the remote object associated with the
specified name
.IP \[bu] 2
Rebind the specified name to a new remote object
.IP \[bu] 2
Destroy the binding for the specified name that\[aq]s associated with a
remote object
.SH OPTIONS
.TP
\f[V]-J\f[R]\f[I]option\f[R]
Used with any Java option to pass the \f[I]option\f[R] following the
\f[V]-J\f[R] (no spaces between the \f[V]-J\f[R] and the option) to the
Java interpreter.

View File

@ -0,0 +1,86 @@
---
# Copyright (c) 1997, 2018, 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.
#
title: 'RMIREGISTRY(1) JDK @@VERSION_SHORT@@ | JDK Commands'
date: @@COPYRIGHT_YEAR@@
lang: en
---
## Name
rmiregistry - create and start a remote object registry on the specified port
on the current host
## Synopsis
`rmiregistry` \[*options*\] \[*port*\]
*options*
: This represents the option for the `rmiregistry` command. See
[Options]
*port*
: The number of a port on the current host at which to start the remote
object registry.
## Description
The `rmiregistry` command creates and starts a remote object registry on the
specified port on the current host. If the port is omitted, then the registry
is started on port 1099. The `rmiregistry` command produces no output and is
typically run in the background, for example:
> `rmiregistry &`
A remote object registry is a bootstrap naming service that's used by RMI
servers on the same host to bind remote objects to names. Clients on local and
remote hosts can then look up remote objects and make remote method
invocations.
The registry is typically used to locate the first remote object on which an
application needs to call methods. That object then provides
application-specific support for finding other objects.
The methods of the `java.rmi.registry.LocateRegistry` class are used to get a
registry operating on the local host or local host and port.
The URL-based methods of the `java.rmi.Naming` class operate on a registry and
can be used to:
- Bind the specified name to a remote object
- Return an array of the names bound in the registry
- Return a reference, a stub, for the remote object associated with the
specified name
- Rebind the specified name to a new remote object
- Destroy the binding for the specified name that's associated with a remote
object
## Options
`-J`*option*
: Used with any Java option to pass the *option* following the `-J` (no
spaces between the `-J` and the option) to the Java interpreter.

View File

@ -1,166 +0,0 @@
.\" Copyright (c) 2006, 2024, 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.19.2
.\"
.\" Define V font for inline verbatim, using C font in formats
.\" that render this, and otherwise B font.
.ie "\f[CB]x\f[R]"x" \{\
. ftr V B
. ftr VI BI
. ftr VB B
. ftr VBI BI
.\}
.el \{\
. ftr V CR
. ftr VI CI
. ftr VB CB
. ftr VBI CBI
.\}
.TH "JRUNSCRIPT" "1" "2025" "JDK 24-ea" "JDK Commands"
.hy
.SH NAME
.PP
jrunscript - run a command-line script shell that supports interactive
and batch modes
.SH SYNOPSIS
.PP
\f[B]Note:\f[R]
.PP
This tool is \f[B]experimental\f[R] and unsupported.
It is deprecated and will be removed in a future release.
.PP
\f[V]jrunscript\f[R] [\f[I]options\f[R]] [\f[I]arguments\f[R]]
.TP
\f[I]options\f[R]
This represents the \f[V]jrunscript\f[R] command-line options that can
be used.
See \f[B]Options for the jrunscript Command\f[R].
.TP
\f[I]arguments\f[R]
Arguments, when used, follow immediately after options or the command
name.
See \f[B]Arguments\f[R].
.SH DESCRIPTION
.PP
The \f[V]jrunscript\f[R] command is a language-independent command-line
script shell.
The \f[V]jrunscript\f[R] command supports both an interactive
(read-eval-print) mode and a batch (\f[V]-f\f[R] option) mode of script
execution.
By default, JavaScript is the language used, but the \f[V]-l\f[R] option
can be used to specify a different language.
By using Java to scripting language communication, the
\f[V]jrunscript\f[R] command supports an exploratory programming style.
.PP
If JavaScript is used, then before it evaluates a user defined script,
the \f[V]jrunscript\f[R] command initializes certain built-in functions
and objects, which are documented in the API Specification for
\f[V]jrunscript\f[R] JavaScript built-in functions.
.SH OPTIONS FOR THE JRUNSCRIPT COMMAND
.TP
\f[V]-cp\f[R] \f[I]path\f[R] or \f[V]-classpath\f[R] \f[I]path\f[R]
Indicates where any class files are that the script needs to access.
.TP
\f[V]-D\f[R]\f[I]name\f[R]\f[V]=\f[R]\f[I]value\f[R]
Sets a Java system property.
.TP
\f[V]-J\f[R]\f[I]flag\f[R]
Passes \f[I]flag\f[R] directly to the Java Virtual Machine where the
\f[V]jrunscript\f[R] command is running.
.TP
\f[V]-l\f[R] \f[I]language\f[R]
Uses the specified scripting language.
By default, JavaScript is used.
To use other scripting languages, you must specify the corresponding
script engine\[aq]s JAR file with the \f[V]-cp\f[R] or
\f[V]-classpath\f[R] option.
.TP
\f[V]-e\f[R] \f[I]script\f[R]
Evaluates the specified script.
This option can be used to run one-line scripts that are specified
completely on the command line.
.TP
\f[V]-encoding\f[R] \f[I]encoding\f[R]
Specifies the character encoding used to read script files.
.TP
\f[V]-f\f[R] \f[I]script-file\f[R]
Evaluates the specified script file (batch mode).
.TP
\f[V]-f -\f[R]
Enters interactive mode to read and evaluate a script from standard
input.
.TP
\f[V]-help\f[R] or \f[V]-?\f[R]
Displays a help message and exits.
.TP
\f[V]-q\f[R]
Lists all script engines available and exits.
.SH ARGUMENTS
.PP
If arguments are present and if no \f[V]-e\f[R] or \f[V]-f\f[R] option
is used, then the first argument is the script file and the rest of the
arguments, if any, are passed as script arguments.
If arguments and the \f[V]-e\f[R] or the \f[V]-f\f[R] option are used,
then all arguments are passed as script arguments.
If arguments \f[V]-e\f[R] and \f[V]-f\f[R] are missing, then the
interactive mode is used.
.SH EXAMPLE OF EXECUTING INLINE SCRIPTS
.RS
.PP
\f[V]jrunscript -e \[dq]print(\[aq]hello world\[aq])\[dq]\f[R]
.RE
.RS
.PP
\f[V]jrunscript -e \[dq]cat(\[aq]http://www.example.com\[aq])\[dq]\f[R]
.RE
.SH EXAMPLE OF USING SPECIFIED LANGUAGE AND EVALUATE THE SCRIPT FILE
.RS
.PP
\f[V]jrunscript -l js -f test.js\f[R]
.RE
.SH EXAMPLE OF INTERACTIVE MODE
.IP
.nf
\f[CB]
jrunscript
js> print(\[aq]Hello World\[rs]n\[aq]);
Hello World
js> 34 + 55
89.0
js> t = new java.lang.Thread(function() { print(\[aq]Hello World\[rs]n\[aq]); })
Thread[Thread-0,5,main]
js> t.start()
js> Hello World
js>
\f[R]
.fi
.SH RUN SCRIPT FILE WITH SCRIPT ARGUMENTS
.PP
In this example, the \f[V]test.js\f[R] file is the script file.
The \f[V]arg1\f[R], \f[V]arg2\f[R], and \f[V]arg3\f[R] arguments are
passed to the script.
The script can access these arguments with an arguments array.
.RS
.PP
\f[V]jrunscript test.js arg1 arg2 arg3\f[R]
.RE

View File

@ -0,0 +1,141 @@
---
# Copyright (c) 2006, 2024, 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.
#
title: 'JRUNSCRIPT(1) JDK @@VERSION_SHORT@@ | JDK Commands'
date: @@COPYRIGHT_YEAR@@
lang: en
---
## Name
jrunscript - run a command-line script shell that supports interactive and
batch modes
## Synopsis
**Note:**
This tool is **experimental** and unsupported. It is deprecated and will be
removed in a future release.
`jrunscript` \[*options*\] \[*arguments*\]
*options*
: This represents the `jrunscript` command-line options that can be used. See
[Options for the jrunscript Command].
*arguments*
: Arguments, when used, follow immediately after options or the command name.
See [Arguments].
## Description
The `jrunscript` command is a language-independent command-line script shell.
The `jrunscript` command supports both an interactive (read-eval-print) mode
and a batch (`-f` option) mode of script execution. By default, JavaScript is
the language used, but the `-l` option can be used to specify a different
language. By using Java to scripting language communication, the `jrunscript`
command supports an exploratory programming style.
If JavaScript is used, then before it evaluates a user defined script, the
`jrunscript` command initializes certain built-in functions and objects, which
are documented in the API Specification for `jrunscript` JavaScript built-in
functions.
## Options for the jrunscript Command
`-cp` *path* or `-classpath` *path*
: Indicates where any class files are that the script needs to access.
`-D`*name*`=`*value*
: Sets a Java system property.
`-J`*flag*
: Passes *flag* directly to the Java Virtual Machine where the `jrunscript`
command is running.
`-l` *language*
: Uses the specified scripting language. By default, JavaScript is used. To
use other scripting languages, you must specify the corresponding script
engine's JAR file with the `-cp` or `-classpath` option.
`-e` *script*
: Evaluates the specified script. This option can be used to run one-line
scripts that are specified completely on the command line.
`-encoding` *encoding*
: Specifies the character encoding used to read script files.
`-f` *script-file*
: Evaluates the specified script file (batch mode).
`-f -`
: Enters interactive mode to read and evaluate a script from standard input.
`-help` or `-?`
: Displays a help message and exits.
`-q`
: Lists all script engines available and exits.
## Arguments
If arguments are present and if no `-e` or `-f` option is used, then the first
argument is the script file and the rest of the arguments, if any, are passed
as script arguments. If arguments and the `-e` or the `-f` option are used,
then all arguments are passed as script arguments. If arguments `-e` and `-f`
are missing, then the interactive mode is used.
## Example of Executing Inline Scripts
> `jrunscript -e "print('hello world')"`
> `jrunscript -e "cat('http://www.example.com')"`
## Example of Using Specified Language and Evaluate the Script File
> `jrunscript -l js -f test.js`
## Example of Interactive Mode
```
jrunscript
js> print('Hello World\n');
Hello World
js> 34 + 55
89.0
js> t = new java.lang.Thread(function() { print('Hello World\n'); })
Thread[Thread-0,5,main]
js> t.start()
js> Hello World
js>
```
## Run Script File with Script Arguments
In this example, the `test.js` file is the script file. The `arg1`, `arg2`, and
`arg3` arguments are passed to the script. The script can access these
arguments with an arguments array.
> `jrunscript test.js arg1 arg2 arg3`

View File

@ -0,0 +1,154 @@
---
# Copyright (c) 2005, 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.
#
title: 'KINIT(1) JDK @@VERSION_SHORT@@ | JDK Commands'
date: @@COPYRIGHT_YEAR@@
lang: en
---
## Name
kinit - obtain and cache Kerberos ticket-granting tickets
## Synopsis
Initial ticket request:
`kinit` \[`-A`\] \[`-f`\] \[`-p`\] \[`-c` *cache\_name*\] \[`-l` *lifetime*\]
\[`-r` *renewable\_time*\] \[\[`-k` \[`-t` *keytab\_file\_name*\]\]
\[*principal*\] \[*password*\]
Renew a ticket:
`kinit` `-R` \[`-c` *cache\_name*\] \[*principal*\]
## Description
This tool is similar in functionality to the `kinit` tool that is commonly
found in other Kerberos implementations, such as SEAM and MIT Reference
implementations. The user must be registered as a principal with the Key
Distribution Center (KDC) prior to running `kinit`.
By default, on Windows, a cache file named *USER\_HOME*`\krb5cc_`*USER\_NAME*
is generated.
The identifier *USER\_HOME* is obtained from the `java.lang.System` property
`user.home`. *USER\_NAME* is obtained from the `java.lang.System` property
`user.name`. If *USER\_HOME* is null, the cache file is stored in the current
directory from which the program is running. *USER\_NAME* is the operating
system's login user name. This user name could be different than the user's
principal name. For example, on Windows, the cache file could be
`C:\Windows\Users\duke\krb5cc_duke`, in which `duke` is the *USER\_NAME* and
`C:\Windows\Users\duke` is the *USER\_HOME*.
By default, the keytab name is retrieved from the Kerberos configuration file.
If the keytab name isn't specified in the Kerberos configuration file, the
kinit tool assumes that the name is *USER\_HOME*`\krb5.keytab`
If you don't specify the password using the *password* option on the command
line, the `kinit` tool prompts you for the password.
**Note:**
The `password` option is provided only for testing purposes. Don't specify your
password in a script or provide your password on the command line. Doing so
will compromise your password.
## Commands
You can specify one of the following commands. After the command, specify the
options for it.
`-A`
: Doesn't include addresses.
`-f`
: Issues a forwardable ticket.
`-p`
: Issues a proxiable ticket.
`-c` *cache\_name*
: The cache name (for example, `FILE:D:\temp\mykrb5cc`).
`-l` *lifetime*
: Sets the lifetime of a ticket. The value can be one of "h:m[:s]",
"NdNhNmNs", and "N". See the [MIT krb5 Time Duration definition](
http://web.mit.edu/kerberos/krb5-1.17/doc/basic/date_format.html#duration)
for more information.
`-r` *renewable\_time*
: Sets the total lifetime that a ticket can be renewed.
`-R`
: Renews a ticket.
`-k`
: Uses keytab
`-t` *keytab\_filename*
: The keytab name (for example, `D:\winnt\profiles\duke\krb5.keytab`).
*principal*
: The principal name (for example, `duke@example.com`).
*password*
: The *principal*'s Kerberos password. **Don't specify this on the command
line or in a script.**
Run `kinit -help` to display the instructions above.
## Examples
Requests credentials valid for authentication from the current client host, for
the default services, storing the credentials cache in the default location
(`C:\Windows\Users\duke\krb5cc_duke`):
> `kinit duke@example.com`
Requests proxiable credentials for a different principal and store these
credentials in a specified file cache:
> `kinit -l 1h -r 10h duke@example.com`
Requests a TGT for the specified principal that will expire in 1 hour but
is renewable for up to 10 hours. Users must renew a ticket before it has
expired. The renewed ticket can be renewed repeatedly within 10 hours
from its initial request.
> `kinit -R duke@example.com`
Renews an existing renewable TGT for the specified principal.
> `kinit -p -c FILE:C:\Windows\Users\duke\credentials\krb5cc_cafebeef
cafebeef@example.com`
Requests proxiable and forwardable credentials for a different principal and
stores these credentials in a specified file cache:
> `kinit -f -p -c FILE:C:\Windows\Users\duke\credentials\krb5cc_cafebeef
cafebeef@example.com`
Displays the help menu for the `kinit` tool:
> `kinit -help`

View File

@ -0,0 +1,98 @@
---
# Copyright (c) 2005, 2018, 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.
#
title: 'KLIST(1) JDK @@VERSION_SHORT@@ | JDK Commands'
date: @@COPYRIGHT_YEAR@@
lang: en
---
## Name
klist - display the entries in the local credentials cache and key table
## Synopsis
`klist` \[`-c` \[`-f`\] \[`-e`\] \[`-a` \[`-n`\]\]\] \[`-k` \[`-t`\] \[`-K`\]\]
\[*name*\] \[`-help`\]
## Description
The `klist` tool displays the entries in the local credentials cache and key
table. After you modify the credentials cache with the `kinit` tool or modify
the keytab with the `ktab` tool, the only way to verify the changes is to view
the contents of the credentials cache or keytab using the `klist` tool. The
`klist` tool doesn't change the Kerberos database.
## Commands
`-c`
: Specifies that the credential cache is to be listed.
The following are the options for credential cache entries:
`-f`
: Show credential flags.
`-e`
: Show the encryption type.
`-a`
: Show addresses.
`-n`
: If the `-a` option is specified, don't reverse resolve addresses.
`-k`
: Specifies that key tab is to be listed.
List the keytab entries. The following are the options for keytab entries:
`-t`
: Show keytab entry timestamps.
`-K`
: Show keytab entry DES keys.
`-e`
: Shows keytab entry key type.
*name*
: Specifies the credential cache name or the keytab name. File-based cache or
keytab's prefix is `FILE:`. If the name isn't specified, the `klist` tool
uses default values for the cache name and keytab. The `kinit`
documentation lists these default values.
`-help`
: Displays instructions.
## Examples
List entries in the keytable specified including keytab entry timestamps and
DES keys:
> `klist -k -t -K FILE:\temp\mykrb5cc`
List entries in the credentials cache specified including credentials flag and
address list:
> `klist -c -f FILE:\temp\mykrb5cc`

View File

@ -0,0 +1,134 @@
---
# Copyright (c) 2005, 2022, 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.
#
title: 'KTAB(1) JDK @@VERSION_SHORT@@ | JDK Commands'
date: @@COPYRIGHT_YEAR@@
lang: en
---
## Name
ktab - manage the principal names and service keys stored in a local key
table
## Synopsis
`ktab` \[*commands*\] \[*options*\]
\[*commands*\] \[*options*\]
: Lists the keytab name and entries, adds new key entries to the keytab,
deletes existing key entries, and displays instructions. See [Commands and
Options].
## Description
The `ktab` enables the user to manage the principal names and service keys
stored in a local key table. Principal and key pairs listed in the keytab
enable services running on a host to authenticate themselves to the Key
Distribution Center (KDC).
Before configuring a server to use Kerberos, you must set up a keytab on the
host running the server. Note that any updates made to the keytab using the
`ktab` tool don't affect the Kerberos database.
A *keytab* is a host's copy of its own keylist, which is analogous to a user's
password. An application server that needs to authenticate itself to the Key
Distribution Center (KDC) must have a keytab which contains its own principal
and key. If you change the keys in the keytab, you must also make the
corresponding changes to the Kerberos database. The `ktab` tool enables you to
list, add, update or delete principal names and key pairs in the key table.
None of these operations affect the Kerberos database.
## Security Alert
Don't specify your password on the command line. Doing so can be a security
risk. For example, an attacker could discover your password while running the
UNIX `ps` command.
Just as it is important for users to protect their passwords, it is equally
important for hosts to protect their keytabs. You should always store keytab
files on the local disk and make them readable only by root. You should never
send a keytab file over a network in the clear.
## Commands and Options
`-l` \[`-e`\] \[`-t`\]
: Lists the keytab name and entries. When `-e` is specified, the encryption
type for each entry is displayed. When `-t` is specified, the timestamp for
each entry is displayed.
`-a` *principal\_name* \[*password*\] \[`-n` *kvno*\] \[`-s` *salt* \| `-f`\] \[`-append`\]
: Adds new key entries to the keytab for the given principal name with an
optional *password*. If a *kvno* is specified, new keys' Key Version
Numbers equal to the value, otherwise, automatically incrementing the Key
Version Numbers. If *salt* is specified, it will be used instead of the
default salt. If `-f` is specified, the KDC will be contacted to
fetch the salt. If `-append` is specified, new keys are appended to the
keytab, otherwise, old keys for the same principal are removed.
No changes are made to the Kerberos database. **Don't specify the password
on the command line or in a script.** This tool will prompt for a password
if it isn't specified.
`-d` *principal\_name* \[`-f`\] \[`-e` *etype*\] \[*kvno* \| `all`\| `old`\]
: Deletes key entries from the keytab for the specified principal. No changes
are made to the Kerberos database.
- If *kvno* is specified, the tool deletes keys whose Key Version Numbers
match kvno. If `all` is specified, delete all keys.
- If `old` is specified, the tool deletes all keys except those with the
highest *kvno*. The default action is `all`.
- If *etype* is specified, the tool only deletes keys of this encryption
type. *etype* should be specified as the numeric value *etype* defined
in RFC 3961, section 8. A prompt to confirm the deletion is displayed
unless `-f` is specified.
When *etype* is provided, only the entry matching this encryption type is
deleted. Otherwise, all entries are deleted.
`-help`
: Displays instructions.
## Common Options
This option can be used with the `-l`, `-a` or `-d` commands.
`-k` *keytab name*
: Specifies the keytab name and path with the `FILE:` prefix.
## Examples
- Lists all the entries in the default keytable
> `ktab -l`
- Adds a new principal to the key table (note that you will be prompted for
your password)
> `ktab -a duke@example.com`
- Deletes a principal from the key table
> `ktab -d duke@example.com`

View File

@ -0,0 +1,75 @@
---
# Copyright (c) 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.
#
title: 'JABSWITCH(1) JDK @@VERSION_SHORT@@ | JDK Commands'
date: @@COPYRIGHT_YEAR@@
lang: en
---
## Name
jabswitch - enable or disable the Java Access Bridge
## Synopsis
`jabswitch` \[ -enable|/enable | -disable|/disable | -version|/version | -?|/? \]
## Options
`-enable`
or
`/enable`
: Enables the Java Access Bridge
`-disable`
or
`/disable`
: Disables the Java Access Bridge
`-version`
or
`/version`
: Displays version information for the `jabswitch` command.
`-?`
or
`/?`
: Displays usage information for the `jabswitch` command.
## Description
The `jabswitch` command is a utility program that enables the
Java Access Bridge to be loaded by the JDK on Windows platforms.
The Java Access Bridge is used by Assistive Technologies
to interact with Java Accessibility APIs of the Java SE platform.
To have any effect, the assistive technology must support the Java Access Bridge.
This command creates or updates a file named `.accessibility.properties`,
in the user's home directory. When selecting the `-enable` option, the file
is populated with the information needed to load the Java Access Bridge.
This file is then read and used in accordance with the specification of the
Java SE
[`java.awt.Toolkit.getDefaultToolkit()`](../../api/java.desktop/java/awt/Toolkit.html#getDefaultToolkit())
API, on initialization.
Note: This command is only provided with JDK for Windows.

View File

@ -0,0 +1,249 @@
---
# Copyright (c) 2017, 2018, 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.
#
title: 'JACCESSINSPECTOR(1) JDK @@VERSION_SHORT@@ | JDK Commands'
date: @@COPYRIGHT_YEAR@@
lang: en
---
## Name
jaccessinspector - examine accessible information about the objects in the
Java Virtual Machine using the Java Accessibility Utilities API
## Description
The `jaccessinspector` tool lets you select different methods for examining the
object accessibility information:
- When events occur such as a change of focus, mouse movement, property
change, menu selection, and the display of a popup menu
- When you press the F1 key when the mouse is over an object, or F2 when the
mouse is over a window
After an object has been selected for examination, the `jaccessinspector` tool
displays the results of calling Java Accessibility API methods on that object.
## Running the jaccessinspector Tool
To use the `jaccessinspector` tool, launch the `jaccessinspector` tool after
launching a Java application. To launch `jaccessinspector`, run the following
command:
**Note:**
`JAVA_HOME` is an environment variable and should be set to the path of the JDK
or JRE, such as `c:\Program Files\Java\jdk-10`.
> `%JAVA_HOME%\bin\jaccessinspector.exe`
You now have two windows open: The Java application window and the
`jaccessinspector` window. The `jaccessinspector` window contains five menus:
- [File Menu]
- [UpdateSettings Menu]
- [JavaEvents Menu]
- [AccessibilityEvents Menu]
- [Options Menu]
The items in **UpdateSettings**, **JavaEvents**, and **AccessibilityEvents**
menus let you query Java applications in a variety of ways.
## File Menu
This section describes the **File** menu items.
AccessBridge DLL Loaded
: Enables and disables AccessBridge DLL Loaded.
Exit
: Exits from the tool.
## UpdateSettings Menu
This section describes the **UpdateSettings** menu items.
Update from Mouse
: Determines the x- and y-coordinates of the mouse (assuming the
`jaccessinspector` tool window is topmost) when the mouse has stopped
moving, and then queries the Java application for the accessible object
underneath the mouse, dumping the output into the `jaccessinspector`
window.
Update with F2 (Mouse HWND)
: Determines the x- and y-coordinates of the mouse (assuming the
`jaccessinspector` tool window is topmost), and then queries the Java
application for the accessible object of the HWND underneath the mouse,
dumping the output into the `jaccessinspector` window.
Update with F1 (Mouse Point)
: Determines the x- and y-coordinates of the mouse (assuming the
`jaccessinspector` tool window is topmost), and then queries the Java
application for the accessible object underneath the cursor, dumping the
output into the `jaccessinspector` window.
## JavaEvents Menu
This section describes the **JavaEvents** menu items.
Track Mouse Events
: Registers with the Java application all Java Mouse Entered events, and upon
receiving one, queries the object that was entered by the cursor and dumps
the output into the `jaccessinspector` window.
**Note:** If the mouse is moved quickly, then there may be some delay
before the displayed information is updated.
Track Focus Events
: Registers with the Java application all Java Focus Gained events, and upon
receiving an event, queries the object that received the focus and dumps
the output into the `jaccessinspector` window.
Track Caret Events
: Register with the Java application all Java Caret Update events, and upon
receiving an event, queries the object in which the caret was updated, and
dumps the output into the `jaccessinspector` window.
**Note:** Because objects that contain carets are almost by definition
objects that are rich text objects, this won't seem as responsive as the
other event tracking options. In real use, one would make fewer
accessibility calls in Caret Update situations (for example, just get the
new letter, word, sentence at the caret location), which would be
significantly faster.
Track Menu Selected \| Deselected \| Cancelled Events
: Registers with the Java application all Menu events, and upon receiving an
event, queries the object in which the caret was updated, and dumps the
output into the `jaccessinspector` window.
Track Popup Visible \| Invisible \| Cancelled Events
: Registers with the Java application all Popup Menu events, and upon
receiving an event, queries the object in which the caret was updated, and
dumps the output into the `jaccessinspector` window.
Track Shutdown Events
: Registers with the Java application to receive a Property Changed event
when a Java application terminates.
## AccessibilityEvents Menu
This section describes the **AccessibilityEvents** menu items.
**Note:** The items listed in the **AccessibilityEvents** menu are the most
important for testing applications, especially for assistive technology
applications.
Track Name Property Events
: Registers with the Java application all Java Property Changed events
specifically on accessible objects in which the Name property has changed,
and upon receiving an event, dumps the output into the scrolling window,
along with information about the property that changed.
Track Description Property Events
: Register with the Java application for all Java Property Changed events
specifically on accessible objects in which the Description property has
changed, and upon receiving an event, dumps the output into the
`jaccessinspector` window, along with information about the property that
changed.
Track State Property Events
: Register with the Java application all Java Property Changed events
specifically on accessible objects in which the State property has changed,
and upon receiving an event, dumps the output into the `jaccessinspector`
window, along with information about the property that changed.
Track Value Property Events
: Register with the Java application all Java Property Changed events
specifically on accessible objects in which the Value property has changed,
and upon receiving an event, dumps the output into the scrolling window,
along with information about the property that changed.
Track Selection Property Events
: Register with the Java application all Java Property Changed events
specifically on accessible objects in which the Selection property has
changed, and upon receiving an event, dumps the output into the
`jaccessinspector` window, along with information about the property that
changed.
Track Text Property Events
: Register with the Java application all Java Property Changed events
specifically on accessible objects in which the Text property has changed,
and upon receiving one event, dump the output into the `jaccessinspector`
window, along with information about the property that changed.
Track Caret Property Events
: Register with the Java application all Java Property Changed events
specifically on accessible objects in which the Caret property has changed,
and upon receiving an event, dumps the output into the `jaccessinspector`
window, along with information about the property that changed.
Track VisibleData Property Events
: Register with the Java application all Java Property Changed events
specifically on accessible objects in which the VisibleData property has
changed, and upon receiving an event, dumps the output into the
`jaccessinspector` window, along with information about the property that
changed.
Track Child Property Events
: Register with the Java application all Java Property Changed events
specifically on accessible objects in which the Child property has changed,
and upon receiving an event, dumps the output into the `jaccessinspector`
window, along with information about the property that changed.
Track Active Descendent Property Events
: Register with the Java application all Java Property Changed events
specifically on accessible objects in which the Active Descendent property
has changed, and upon receiving an event, dumps the output into the
`jaccessinspector` window, along with information about the property that
changed.
Track Table Model Change Property Events
: Register with the Java application all Property Changed events specifically
on accessible objects in which the Table Model Change property has changed,
and upon receiving an event, dumps the output into the `jaccessinspector`
window, along with information about the property that changed.
## Options Menu
This section describes the **Options** menu items.
Monitor the same events as JAWS
: Enables monitoring of only the events also monitored by JAWS.
Monitor All Events
: Enables monitoring of all events in the `jaccessinspector` window.
Reset All Events
: Resets the selected Options to the default settings.
Go To Message
: Opens the **Go To Message** dialog that lets you display a logged message
by entering its message number.
Clear Message History
: Clears the history of logged messages from the `jaccessinspector` window.

View File

@ -0,0 +1,71 @@
---
# Copyright (c) 2017, 2018, 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.
#
title: 'JACCESSWALKER(1) JDK @@VERSION_SHORT@@ | JDK Commands'
date: @@COPYRIGHT_YEAR@@
lang: en
---
## Name
jaccesswalker - navigate through the component trees in a particular Java
Virtual Machine and present the hierarchy in a tree view
## Description
You select a node in the tree, and from the **Panels** menu, you select
**Accessibility API Panel**. The `jaccesswalker` tool shows you the
accessibility information for the object in the window.
## Running the jaccesswalker Tool
To use `jaccesswalker`, launch the `jaccesswalker` tool after launching a Java
application. For example, to launch `jaccesswalker`, enter the following
command:
**Note:**
`JAVA_HOME` is an environment variable and should be set to the path of the JDK
or JRE, such as, `c:\Program Files\Java\jdk-10`.
> `%JAVA_HOME%\bin\jaccesswalker.exe`
You now have two windows open: The Java application window, and the window for
the `jaccesswalker` tool. There are two tasks that you can do with
`jaccesswalker` . You can build a tree view of the Java applications' GUI
hierarchy, and you can query the Java Accessibility API information of a
particular element in the GUI hierarchy.
## Building the GUI Hierarchy
From the **File** menu, select **Refresh Tree** menu. The `jaccesswalker` tool
builds a list of the top-level windows belonging to Java applications. The tool
then recursively queries the elements in those windows, and builds a tree of
all of the GUI components in all of the Java applications in all of the JVMs
running in the system.
## Examining a GUI Component
After a GUI tree is built, you can view detailed accessibility information
about an individual GUI component by selecting it in the tree, then selecting
**Panels**, and then **Display Accessibility Information**.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,90 +0,0 @@
.\" Copyright (c) 1997, 2018, 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.19.2
.\"
.\" Define V font for inline verbatim, using C font in formats
.\" that render this, and otherwise B font.
.ie "\f[CB]x\f[R]"x" \{\
. ftr V B
. ftr VI BI
. ftr VB B
. ftr VBI BI
.\}
.el \{\
. ftr V CR
. ftr VI CI
. ftr VB CB
. ftr VBI CBI
.\}
.TH "SERIALVER" "1" "2025" "JDK 24-ea" "JDK Commands"
.hy
.SH NAME
.PP
serialver - return the \f[V]serialVersionUID\f[R] for one or more
classes in a form suitable for copying into an evolving class
.SH SYNOPSIS
.PP
\f[V]serialver\f[R] [\f[I]options\f[R]] [\f[I]classnames\f[R]]
.TP
\f[I]options\f[R]
This represents the command-line options for the \f[V]serialver\f[R]
command.
See \f[B]Options for serialver\f[R].
.TP
\f[I]classnames\f[R]
The classes for which \f[V]serialVersionUID\f[R] is to be returned.
.SH DESCRIPTION
.PP
The \f[V]serialver\f[R] command returns the \f[V]serialVersionUID\f[R]
for one or more classes in a form suitable for copying into an evolving
class.
When called with no arguments, the \f[V]serialver\f[R] command prints a
usage line.
.SH OPTIONS FOR SERIALVER
.TP
\f[V]-classpath\f[R] \f[I]path-files\f[R]
Sets the search path for application classes and resources.
Separate classes and resources with a colon (:).
.TP
\f[V]-J\f[R]\f[I]option\f[R]
Passes the specified \f[I]option\f[R] to the Java Virtual Machine, where
\f[I]option\f[R] is one of the options described on the reference page
for the Java application launcher.
For example, \f[V]-J-Xms48m\f[R] sets the startup memory to 48 MB.
.SH NOTES
.PP
The \f[V]serialver\f[R] command loads and initializes the specified
classes in its virtual machine, and by default, it doesn\[aq]t set a
security manager.
If the \f[V]serialver\f[R] command is to be run with untrusted classes,
then a security manager can be set with the following option:
.RS
.PP
\f[V]-J-Djava.security.manager\f[R]
.RE
.PP
When necessary, a security policy can be specified with the following
option:
.RS
.PP
\f[V]-J-Djava.security.policy=\f[R]\f[I]policy_file\f[R]
.RE

View File

@ -0,0 +1,74 @@
---
# Copyright (c) 1997, 2018, 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.
#
title: 'SERIALVER(1) JDK @@VERSION_SHORT@@ | JDK Commands'
date: @@COPYRIGHT_YEAR@@
lang: en
---
## Name
serialver - return the `serialVersionUID` for one or more classes in a form
suitable for copying into an evolving class
## Synopsis
`serialver` \[*options*\] \[*classnames*\]
*options*
: This represents the command-line options for the `serialver` command. See
[Options for serialver].
*classnames*
: The classes for which `serialVersionUID` is to be returned.
## Description
The `serialver` command returns the `serialVersionUID` for one or more classes
in a form suitable for copying into an evolving class. When called with no
arguments, the `serialver` command prints a usage line.
## Options for serialver
`-classpath` *path-files*
: Sets the search path for application classes and resources. Separate
classes and resources with a colon (:).
`-J`*option*
: Passes the specified *option* to the Java Virtual Machine, where *option*
is one of the options described on the reference page for the Java
application launcher. For example, `-J-Xms48m` sets the startup memory to
48 MB.
## Notes
The `serialver` command loads and initializes the specified classes in its
virtual machine, and by default, it doesn't set a security manager. If the
`serialver` command is to be run with untrusted classes, then a security
manager can be set with the following option:
> `-J-Djava.security.manager`
When necessary, a security policy can be specified with the following option:
> `-J-Djava.security.policy=`*policy\_file*

View File

@ -1,218 +0,0 @@
.\" Copyright (c) 2019, 2024, 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.19.2
.\"
.\" Define V font for inline verbatim, using C font in formats
.\" that render this, and otherwise B font.
.ie "\f[CB]x\f[R]"x" \{\
. ftr V B
. ftr VI BI
. ftr VB B
. ftr VBI BI
.\}
.el \{\
. ftr V CR
. ftr VI CI
. ftr VB CB
. ftr VBI CBI
.\}
.TH "JHSDB" "1" "2025" "JDK 24-ea" "JDK Commands"
.hy
.SH NAME
.PP
jhsdb - attach to a Java process or launch a postmortem debugger to
analyze the content of a core dump from a crashed Java Virtual Machine
(JVM)
.SH SYNOPSIS
.PP
\f[B]WARNING:\f[R] The \f[V]debugd\f[R] subcommand and
\f[V]--connect\f[R] options are deprecated.
They will be removed in a future release.
.PP
\f[V]jhsdb\f[R] \f[V]clhsdb\f[R] [\f[V]--pid\f[R] \f[I]pid\f[R] |
\f[V]--exe\f[R] \f[I]executable\f[R] \f[V]--core\f[R]
\f[I]coredump\f[R]]
.PP
\f[V]jhsdb\f[R] \f[V]hsdb\f[R] [\f[V]--pid\f[R] \f[I]pid\f[R] |
\f[V]--exe\f[R] \f[I]executable\f[R] \f[V]--core\f[R]
\f[I]coredump\f[R]]
.PP
\f[V]jhsdb\f[R] \f[V]debugd\f[R] (\f[V]--pid\f[R] \f[I]pid\f[R] |
\f[V]--exe\f[R] \f[I]executable\f[R] \f[V]--core\f[R]
\f[I]coredump\f[R]) [\f[I]options\f[R]]
.PP
\f[V]jhsdb\f[R] \f[V]jstack\f[R] (\f[V]--pid\f[R] \f[I]pid\f[R] |
\f[V]--exe\f[R] \f[I]executable\f[R] \f[V]--core\f[R] \f[I]coredump\f[R]
| \f[V]--connect\f[R] \f[I][server-id\[at]]debugd-host\f[R])
[\f[I]options\f[R]]
.PP
\f[V]jhsdb\f[R] \f[V]jmap\f[R] (\f[V]--pid\f[R] \f[I]pid\f[R] |
\f[V]--exe\f[R] \f[I]executable\f[R] \f[V]--core\f[R] \f[I]coredump\f[R]
| \f[V]--connect\f[R] \f[I][server-id\[at]]debugd-host\f[R])
[\f[I]options\f[R]]
.PP
\f[V]jhsdb\f[R] \f[V]jinfo\f[R] (\f[V]--pid\f[R] \f[I]pid\f[R] |
\f[V]--exe\f[R] \f[I]executable\f[R] \f[V]--core\f[R] \f[I]coredump\f[R]
| \f[V]--connect\f[R] \f[I][server-id\[at]]debugd-host\f[R])
[\f[I]options\f[R]]
.PP
\f[V]jhsdb\f[R] \f[V]jsnap\f[R] (\f[V]--pid\f[R] \f[I]pid\f[R] |
\f[V]--exe\f[R] \f[I]executable\f[R] \f[V]--core\f[R] \f[I]coredump\f[R]
| \f[V]--connect\f[R] \f[I][server-id\[at]]debugd-host\f[R])
[\f[I]options\f[R]]
.TP
\f[I]pid\f[R]
The process ID to which the \f[V]jhsdb\f[R] tool should attach.
The process must be a Java process.
To get a list of Java processes running on a machine, use the
\f[V]ps\f[R] command or, if the JVM processes are not running in a
separate docker instance, the \f[B]jps\f[R] command.
.TP
\f[I]executable\f[R]
The Java executable file from which the core dump was produced.
.TP
\f[I]coredump\f[R]
The core file to which the \f[V]jhsdb\f[R] tool should attach.
.TP
\f[I][server-id\[at]]debugd-host\f[R]
An optional server ID and the address of the remote debug server
(debugd).
.TP
\f[I]options\f[R]
The command-line options for a \f[V]jhsdb\f[R] mode.
See \f[B]Options for the debugd Mode\f[R], \f[B]Options for the jstack
Mode\f[R], \f[B]Options for the jmap Mode\f[R], \f[B]Options for the
jinfo Mode\f[R], and \f[B]Options for the jsnap Mode\f[R].
.PP
\f[B]Note:\f[R]
.PP
Either the \f[I]pid\f[R] or the pair of \f[I]executable\f[R] and
\f[I]core\f[R] files or the \f[I][server-id\[at]]debugd-host\f[R] must
be provided for \f[V]debugd\f[R], \f[V]jstack\f[R], \f[V]jmap\f[R],
\f[V]jinfo\f[R] and \f[V]jsnap\f[R] modes.
.SH DESCRIPTION
.PP
You can use the \f[V]jhsdb\f[R] tool to attach to a Java process or to
launch a postmortem debugger to analyze the content of a core-dump from
a crashed Java Virtual Machine (JVM).
This command is experimental and unsupported.
.PP
\f[B]Note:\f[R]
.PP
Attaching the \f[V]jhsdb\f[R] tool to a live process will cause the
process to hang and the process will probably crash when the debugger
detaches.
.PP
The \f[V]jhsdb\f[R] tool can be launched in any one of the following
modes:
.TP
\f[V]jhsdb clhsdb\f[R]
Starts the interactive command-line debugger.
.TP
\f[V]jhsdb hsdb\f[R]
Starts the interactive GUI debugger.
.TP
\f[V]jhsdb debugd\f[R]
Starts the remote debug server.
.TP
\f[V]jhsdb jstack\f[R]
Prints stack and locks information.
.TP
\f[V]jhsdb jmap\f[R]
Prints heap information.
.TP
\f[V]jhsdb jinfo\f[R]
Prints basic JVM information.
.TP
\f[V]jhsdb jsnap\f[R]
Prints performance counter information.
.TP
\f[V]jhsdb\f[R] \f[I]command\f[R] \f[V]--help\f[R]
Displays the options available for the \f[I]command\f[R].
.SH OPTIONS FOR THE DEBUGD MODE
.TP
\f[V]--serverid\f[R] \f[I]server-id\f[R]
An optional unique ID for this debug server.
This is required if multiple debug servers are run on the same machine.
.TP
\f[V]--rmiport\f[R] \f[I]port\f[R]
Sets the port number to which the RMI connector is bound.
If not specified a random available port is used.
.TP
\f[V]--registryport\f[R] \f[I]port\f[R]
Sets the RMI registry port.
This option overrides the system property
\[aq]sun.jvm.hotspot.rmi.port\[aq].
If not specified, the system property is used.
If the system property is not set, the default port 1099 is used.
.TP
\f[V]--hostname\f[R] \f[I]hostname\f[R]
Sets the hostname the RMI connector is bound.
The value could be a hostname or an IPv4/IPv6 address.
This option overrides the system property
\[aq]java.rmi.server.hostname\[aq].
If not specified, the system property is used.
If the system property is not set, a system hostname is used.
.SH OPTIONS FOR THE JINFO MODE
.TP
\f[V]--flags\f[R]
Prints the VM flags.
.TP
\f[V]--sysprops\f[R]
Prints the Java system properties.
.TP
no option
Prints the VM flags and the Java system properties.
.SH OPTIONS FOR THE JMAP MODE
.TP
no option
Prints the same information as Solaris \f[V]pmap\f[R].
.TP
\f[V]--heap\f[R]
Prints the \f[V]java\f[R] heap summary.
.TP
\f[V]--binaryheap\f[R]
Dumps the \f[V]java\f[R] heap in \f[V]hprof\f[R] binary format.
.TP
\f[V]--dumpfile\f[R] \f[I]name\f[R]
The name of the dumpfile.
.TP
\f[V]--histo\f[R]
Prints the histogram of \f[V]java\f[R] object heap.
.TP
\f[V]--clstats\f[R]
Prints the class loader statistics.
.TP
\f[V]--finalizerinfo\f[R]
Prints the information on objects awaiting finalization.
.SH OPTIONS FOR THE JSTACK MODE
.TP
\f[V]--locks\f[R]
Prints the \f[V]java.util.concurrent\f[R] locks information.
.TP
\f[V]--mixed\f[R]
Attempts to print both \f[V]java\f[R] and native frames if the platform
allows it.
.SH OPTIONS FOR THE JSNAP MODE
.TP
\f[V]--all\f[R]
Prints all performance counters.

View File

@ -0,0 +1,186 @@
---
# Copyright (c) 2019, 2024, 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.
#
title: 'JHSDB(1) JDK @@VERSION_SHORT@@ | JDK Commands'
date: @@COPYRIGHT_YEAR@@
lang: en
---
## Name
jhsdb - attach to a Java process or launch a postmortem debugger to analyze
the content of a core dump from a crashed Java Virtual Machine (JVM)
## Synopsis
**WARNING:** The `debugd` subcommand and `--connect` options are deprecated. They will be removed in a future release.
`jhsdb` `clhsdb` \[`--pid` *pid* \| `--exe` *executable* `--core` *coredump*\]
`jhsdb` `hsdb` \[`--pid` *pid* \| `--exe` *executable* `--core` *coredump*\]
`jhsdb` `debugd` (`--pid` *pid* \| `--exe` *executable* `--core` *coredump*)
\[*options*\]
`jhsdb` `jstack` (`--pid` *pid* \| `--exe` *executable* `--core` *coredump* \|
`--connect` *\[server-id@\]debugd-host*) \[*options*\]
`jhsdb` `jmap` (`--pid` *pid* \| `--exe` *executable* `--core` *coredump* \|
`--connect` *\[server-id@\]debugd-host*) \[*options*\]
`jhsdb` `jinfo` (`--pid` *pid* \| `--exe` *executable* `--core` *coredump* \|
`--connect` *\[server-id@\]debugd-host*) \[*options*\]
`jhsdb` `jsnap` (`--pid` *pid* \| `--exe` *executable* `--core` *coredump* \|
`--connect` *\[server-id@\]debugd-host*) \[*options*\]
*pid*
: The process ID to which the `jhsdb` tool should attach. The process must be
a Java process. To get a list of Java processes running on a machine, use
the `ps` command or, if the JVM processes are not running in a separate
docker instance, the [jps](jps.html) command.
*executable*
: The Java executable file from which the core dump was produced.
*coredump*
: The core file to which the `jhsdb` tool should attach.
*\[server-id@\]debugd-host*
: An optional server ID and the address of the remote debug server (debugd).
*options*
: The command-line options for a `jhsdb` mode. See [Options for the debugd Mode],
[Options for the jstack Mode], [Options for the jmap Mode],
[Options for the jinfo Mode], and [Options for the jsnap Mode].
**Note:**
Either the *pid* or the pair of *executable* and *core* files or
the *\[server-id@\]debugd-host* must be provided for `debugd`, `jstack`, `jmap`,
`jinfo` and `jsnap` modes.
## Description
You can use the `jhsdb` tool to attach to a Java process or to launch a
postmortem debugger to analyze the content of a core-dump from a crashed Java
Virtual Machine (JVM). This command is experimental and unsupported.
**Note:**
Attaching the `jhsdb` tool to a live process will cause the process to hang and
the process will probably crash when the debugger detaches.
The `jhsdb` tool can be launched in any one of the following modes:
`jhsdb clhsdb`
: Starts the interactive command-line debugger.
`jhsdb hsdb`
: Starts the interactive GUI debugger.
`jhsdb debugd`
: Starts the remote debug server.
`jhsdb jstack`
: Prints stack and locks information.
`jhsdb jmap`
: Prints heap information.
`jhsdb jinfo`
: Prints basic JVM information.
`jhsdb jsnap`
: Prints performance counter information.
`jhsdb` *command* `--help`
: Displays the options available for the *command*.
## Options for the debugd Mode
`--serverid` *server-id*
: An optional unique ID for this debug server. This is required if multiple
debug servers are run on the same machine.
`--rmiport` *port*
: Sets the port number to which the RMI connector is bound. If not specified
a random available port is used.
`--registryport` *port*
: Sets the RMI registry port. This option overrides the system property
'sun.jvm.hotspot.rmi.port'. If not specified, the system property is used.
If the system property is not set, the default port 1099 is used.
`--hostname` *hostname*
: Sets the hostname the RMI connector is bound. The value could be a hostname
or an IPv4/IPv6 address. This option overrides the system property
'java.rmi.server.hostname'. If not specified, the system property is used.
If the system property is not set, a system hostname is used.
## Options for the jinfo Mode
`--flags`
: Prints the VM flags.
`--sysprops`
: Prints the Java system properties.
no option
: Prints the VM flags and the Java system properties.
## Options for the jmap Mode
no option
: Prints the same information as Solaris `pmap`.
`--heap`
: Prints the `java` heap summary.
`--binaryheap`
: Dumps the `java` heap in `hprof` binary format.
`--dumpfile` *name*
: The name of the dumpfile.
`--histo`
: Prints the histogram of `java` object heap.
`--clstats`
: Prints the class loader statistics.
`--finalizerinfo`
: Prints the information on objects awaiting finalization.
## Options for the jstack Mode
`--locks`
: Prints the `java.util.concurrent` locks information.
`--mixed`
: Attempts to print both `java` and native frames if the platform allows it.
## Options for the jsnap Mode
`--all`
: Prints all performance counters.

View File

@ -1,193 +0,0 @@
.\" Copyright (c) 2021, 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.19.2
.\"
.\" Define V font for inline verbatim, using C font in formats
.\" that render this, and otherwise B font.
.ie "\f[CB]x\f[R]"x" \{\
. ftr V B
. ftr VI BI
. ftr VB B
. ftr VBI BI
.\}
.el \{\
. ftr V CR
. ftr VI CI
. ftr VB CB
. ftr VBI CBI
.\}
.TH "JWEBSERVER" "1" "2025" "JDK 24-ea" "JDK Commands"
.hy
.SH NAME
.PP
jwebserver - launch the Java Simple Web Server
.SH SYNOPSIS
.PP
\f[V]jwebserver\f[R] [\f[I]options\f[R]]
.TP
\f[I]options\f[R]
Command-line options.
For a detailed description of the options, see \f[B]Options\f[R].
.SH DESCRIPTION
.PP
The \f[V]jwebserver\f[R] tool provides a minimal HTTP server, designed
to be used for prototyping, testing, and debugging.
It serves a single directory hierarchy, and only serves static files.
Only HTTP/1.1 is supported; HTTP/2 and HTTPS are not supported.
.PP
Only idempotent HEAD and GET requests are served.
Any other requests receive a \f[V]501 - Not Implemented\f[R] or a
\f[V]405 - Not Allowed\f[R] response.
GET requests are mapped to the directory being served, as follows:
.IP \[bu] 2
If the requested resource is a file, its content is served.
.IP \[bu] 2
If the requested resource is a directory that contains an index file,
the content of the index file is served.
.IP \[bu] 2
Otherwise, the names of all files and subdirectories of the directory
are listed.
Symbolic links and hidden files are not listed or served.
.PP
MIME types are configured automatically, using the built-in table.
For example, \f[V].html\f[R] files are served as \f[V]text/html\f[R] and
\f[V].java\f[R] files are served as \f[V]text/plain\f[R].
.PP
\f[V]jwebserver\f[R] is located in the jdk.httpserver module, and can
alternatively be started with \f[V]java -m jdk.httpserver\f[R].
It is based on the web server implementation in the
\f[V]com.sun.net.httpserver\f[R] package.
The \f[V]com.sun.net.httpserver.SimpleFileServer\f[R] class provides a
programmatic way to retrieve the server and its components for reuse and
extension.
.SH USAGE
.IP
.nf
\f[CB]
jwebserver [-b bind address] [-p port] [-d directory]
[-o none|info|verbose] [-h to show options]
[-version to show version information]
\f[R]
.fi
.SH OPTIONS
.TP
\f[V]-h\f[R] or \f[V]-?\f[R] or \f[V]--help\f[R]
Prints the help message and exits.
.TP
\f[V]-b\f[R] \f[I]addr\f[R] or \f[V]--bind-address\f[R] \f[I]addr\f[R]
Specifies the address to bind to.
Default: 127.0.0.1 or ::1 (loopback).
For all interfaces use \f[V]-b 0.0.0.0\f[R] or \f[V]-b ::\f[R].
.TP
\f[V]-d\f[R] \f[I]dir\f[R] or \f[V]--directory\f[R] \f[I]dir\f[R]
Specifies the directory to serve.
Default: current directory.
.TP
\f[V]-o\f[R] \f[I]level\f[R] or \f[V]--output\f[R] \f[I]level\f[R]
Specifies the output format.
\f[V]none\f[R] | \f[V]info\f[R] | \f[V]verbose\f[R].
Default: \f[V]info\f[R].
.TP
\f[V]-p\f[R] \f[I]port\f[R] or \f[V]--port\f[R] \f[I]port\f[R]
Specifies the port to listen on.
Default: 8000.
.TP
\f[V]-version\f[R] or \f[V]--version\f[R]
Prints the version information and exits.
.PP
To stop the server, press \f[V]Ctrl + C\f[R].
.SH STARTING THE SERVER
.PP
The following command starts the Simple Web Server:
.IP
.nf
\f[CB]
$ jwebserver
\f[R]
.fi
.PP
If startup is successful, the server prints a message to
\f[V]System.out\f[R] listing the local address and the absolute path of
the directory being served.
For example:
.IP
.nf
\f[CB]
$ jwebserver
Binding to loopback by default. For all interfaces use \[dq]-b 0.0.0.0\[dq] or \[dq]-b ::\[dq].
Serving /cwd and subdirectories on 127.0.0.1 port 8000
URL http://127.0.0.1:8000/
\f[R]
.fi
.SH CONFIGURATION
.PP
By default, the server runs in the foreground and binds to the loopback
address and port 8000.
This can be changed with the \f[V]-b\f[R] and \f[V]-p\f[R] options.
For example, to bind the Simple Web Server to all interfaces, use:
.IP
.nf
\f[CB]
$ jwebserver -b 0.0.0.0
Serving /cwd and subdirectories on 0.0.0.0 (all interfaces) port 8000
URL http://123.456.7.891:8000/
\f[R]
.fi
.PP
Note that this makes the web server accessible to all hosts on the
network.
\f[I]Do not do this unless you are sure the server cannot leak any
sensitive information.\f[R]
.PP
As another example, use the following command to run on port 9000:
.IP
.nf
\f[CB]
$ jwebserver -p 9000
\f[R]
.fi
.PP
By default, the files of the current directory are served.
A different directory can be specified with the \f[V]-d\f[R] option.
.PP
By default, every request is logged on the console.
The output looks like this:
.IP
.nf
\f[CB]
127.0.0.1 - - [10/Feb/2021:14:34:11 +0000] \[dq]GET /some/subdirectory/ HTTP/1.1\[dq] 200 -
\f[R]
.fi
.PP
Logging output can be changed with the \f[V]-o\f[R] option.
The default setting is \f[V]info\f[R].
The \f[V]verbose\f[R] setting additionally includes the request and
response headers as well as the absolute path of the requested resource.
.SH STOPPING THE SERVER
.PP
Once started successfully, the server runs until it is stopped.
On Unix platforms, the server can be stopped by sending it a
\f[V]SIGINT\f[R] signal (\f[V]Ctrl+C\f[R] in a terminal window).
.SH HELP OPTION
.PP
The \f[V]-h\f[R] option displays a help message describing the usage and
the options of the \f[V]jwebserver\f[R].

View File

@ -0,0 +1,152 @@
---
# Copyright (c) 2021, 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.
#
title: 'JWEBSERVER(1) JDK @@VERSION_SHORT@@ | JDK Commands'
date: @@COPYRIGHT_YEAR@@
lang: en
---
## Name
jwebserver - launch the Java Simple Web Server
## Synopsis
`jwebserver` \[*options*\]
*options*
: Command-line options. For a detailed description of the options, see [Options].
## Description
The `jwebserver` tool provides a minimal HTTP server, designed to be used
for prototyping, testing, and debugging. It serves a single directory hierarchy,
and only serves static files. Only HTTP/1.1 is supported;
HTTP/2 and HTTPS are not supported.
Only idempotent HEAD and GET requests are served. Any other requests receive
a `501 - Not Implemented` or a `405 - Not Allowed` response. GET requests are
mapped to the directory being served, as follows:
* If the requested resource is a file, its content is served.
* If the requested resource is a directory that contains an index file,
the content of the index file is served.
* Otherwise, the names of all files and subdirectories of the directory are
listed. Symbolic links and hidden files are not listed or served.
MIME types are configured automatically, using the built-in table. For example,
`.html` files are served as `text/html` and `.java` files are served as
`text/plain`.
`jwebserver` is located in the jdk.httpserver module, and can alternatively
be started with `java -m jdk.httpserver`. It is based on the web server
implementation in the `com.sun.net.httpserver` package.
The `com.sun.net.httpserver.SimpleFileServer` class provides a programmatic
way to retrieve the server and its components for reuse and extension.
## Usage
```
jwebserver [-b bind address] [-p port] [-d directory]
[-o none|info|verbose] [-h to show options]
[-version to show version information]
```
## Options
`-h` or `-?` or `--help`
: Prints the help message and exits.
`-b` *addr* or `--bind-address` *addr*
: Specifies the address to bind to.
Default: 127.0.0.1 or ::1 (loopback).
For all interfaces use `-b 0.0.0.0` or `-b ::`.
`-d` *dir* or `--directory` *dir*
: Specifies the directory to serve.
Default: current directory.
`-o` *level* or `--output` *level*
: Specifies the output format. `none` | `info` | `verbose`.
Default: `info`.
`-p` *port* or `--port` *port*
: Specifies the port to listen on.
Default: 8000.
`-version` or `--version`
: Prints the version information and exits.
To stop the server, press `Ctrl + C`.
## Starting the Server
The following command starts the Simple Web Server:
```
$ jwebserver
```
If startup is successful, the server prints a message to `System.out`
listing the local address and the absolute path of the directory being
served. For example:
```
$ jwebserver
Binding to loopback by default. For all interfaces use "-b 0.0.0.0" or "-b ::".
Serving /cwd and subdirectories on 127.0.0.1 port 8000
URL http://127.0.0.1:8000/
```
## Configuration
By default, the server runs in the foreground and binds to the loopback
address and port 8000. This can be changed with the `-b` and `-p` options.
For example, to bind the Simple Web Server to all interfaces, use:
```
$ jwebserver -b 0.0.0.0
Serving /cwd and subdirectories on 0.0.0.0 (all interfaces) port 8000
URL http://123.456.7.891:8000/
```
Note that this makes the web server accessible to all hosts on the network.
*Do not do this unless you are sure the server cannot leak any sensitive
information.*
As another example, use the following command to run on port 9000:
```
$ jwebserver -p 9000
```
By default, the files of the current directory are served. A different
directory can be specified with the `-d` option.
By default, every request is logged on the console. The output looks like
this:
```
127.0.0.1 - - [10/Feb/2021:14:34:11 +0000] "GET /some/subdirectory/ HTTP/1.1" 200 -
```
Logging output can be changed with the `-o` option. The default setting is
`info`. The `verbose` setting additionally includes the request and response
headers as well as the absolute path of the requested resource.
## Stopping the Server
Once started successfully, the server runs until it is stopped. On Unix
platforms, the server can be stopped by sending it a `SIGINT` signal
(`Ctrl+C` in a terminal window).
## Help Option
The `-h` option displays a help message describing the usage and the options
of the `jwebserver`.

View File

@ -1,379 +0,0 @@
.\" Copyright (c) 1997, 2024, 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.19.2
.\"
.\" Define V font for inline verbatim, using C font in formats
.\" that render this, and otherwise B font.
.ie "\f[CB]x\f[R]"x" \{\
. ftr V B
. ftr VI BI
. ftr VB B
. ftr VBI BI
.\}
.el \{\
. ftr V CR
. ftr VI CI
. ftr VB CB
. ftr VBI CBI
.\}
.TH "JAR" "1" "2025" "JDK 24-ea" "JDK Commands"
.hy
.SH NAME
.PP
jar - create an archive for classes and resources, and manipulate or
restore individual classes or resources from an archive
.SH SYNOPSIS
.PP
\f[V]jar\f[R] [\f[I]OPTION\f[R] ...]
[ [\f[V]--release\f[R] \f[I]VERSION\f[R]] [\f[V]-C\f[R] \f[I]dir\f[R]]
\f[I]files\f[R]] ...
.SH DESCRIPTION
.PP
The \f[V]jar\f[R] command is a general-purpose archiving and compression
tool, based on the ZIP and ZLIB compression formats.
Initially, the \f[V]jar\f[R] command was designed to package Java
applets (not supported since JDK 11) or applications; however, beginning
with JDK 9, users can use the \f[V]jar\f[R] command to create modular
JARs.
For transportation and deployment, it\[aq]s usually more convenient to
package modules as modular JARs.
.PP
The syntax for the \f[V]jar\f[R] command resembles the syntax for the
\f[V]tar\f[R] command.
It has several main operation modes, defined by one of the mandatory
operation arguments.
Other arguments are either options that modify the behavior of the
operation or are required to perform the operation.
.PP
When modules or the components of an application (files, images and
sounds) are combined into a single archive, they can be downloaded by a
Java agent (such as a browser) in a single HTTP transaction, rather than
requiring a new connection for each piece.
This dramatically improves download times.
The \f[V]jar\f[R] command also compresses files, which further improves
download time.
The \f[V]jar\f[R] command also enables individual entries in a file to
be signed so that their origin can be authenticated.
A JAR file can be used as a class path entry, whether or not it\[aq]s
compressed.
.PP
An archive becomes a modular JAR when you include a module descriptor,
\f[V]module-info.class\f[R], in the root of the given directories or in
the root of the \f[V].jar\f[R] archive.
The following operations described in \f[B]Operation Modifiers Valid
Only in Create and Update Modes\f[R] are valid only when creating or
updating a modular jar or updating an existing non-modular jar:
.IP \[bu] 2
\f[V]--module-version\f[R]
.IP \[bu] 2
\f[V]--hash-modules\f[R]
.IP \[bu] 2
\f[V]--module-path\f[R]
.PP
\f[B]Note:\f[R]
.PP
All mandatory or optional arguments for long options are also mandatory
or optional for any corresponding short options.
.SH MAIN OPERATION MODES
.PP
When using the \f[V]jar\f[R] command, you must specify the operation for
it to perform.
You specify the operation mode for the \f[V]jar\f[R] command by
including the appropriate operation arguments described in this section.
You can mix an operation argument with other one-letter options.
Generally the operation argument is the first argument specified on the
command line.
.TP
\f[V]-c\f[R] or \f[V]--create\f[R]
Creates the archive.
.TP
\f[V]-i\f[R] \f[I]FILE\f[R] or \f[V]--generate-index=\f[R]\f[I]FILE\f[R]
Generates index information for the specified JAR file.
This option is deprecated and may be removed in a future release.
.TP
\f[V]-t\f[R] or \f[V]--list\f[R]
Lists the table of contents for the archive.
.TP
\f[V]-u\f[R] or \f[V]--update\f[R]
Updates an existing JAR file.
.TP
\f[V]-x\f[R] or \f[V]--extract\f[R]
Extracts the named (or all) files from the archive.
If a file with the same name appears more than once in the archive, each
copy will be extracted, with later copies overwriting (replacing)
earlier copies unless -k is specified.
.TP
\f[V]-d\f[R] or \f[V]--describe-module\f[R]
Prints the module descriptor or automatic module name.
.SH OPERATION MODIFIERS VALID IN ANY MODE
.PP
You can use the following options to customize the actions of any
operation mode included in the \f[V]jar\f[R] command.
.TP
\f[V]-C\f[R] \f[I]DIR\f[R]
When used with the create operation mode, changes the specified
directory and includes the \f[I]files\f[R] specified at the end of the
command line.
.RS
.PP
\f[V]jar\f[R] [\f[I]OPTION\f[R] ...]
[ [\f[V]--release\f[R] \f[I]VERSION\f[R]] [\f[V]-C\f[R] \f[I]dir\f[R]]
\f[I]files\f[R]]
.PP
When used with the extract operation mode, specifies the destination
directory where the JAR file will be extracted.
Unlike with the create operation mode, this option can be specified only
once with the extract operation mode.
.RE
.TP
\f[V]-f\f[R] \f[I]FILE\f[R] or \f[V]--file=\f[R]\f[I]FILE\f[R]
Specifies the archive file name.
.TP
\f[V]--release\f[R] \f[I]VERSION\f[R]
Creates a multirelease JAR file.
Places all files specified after the option into a versioned directory
of the JAR file named
\f[V]META-INF/versions/\f[R]\f[I]VERSION\f[R]\f[V]/\f[R], where
\f[I]VERSION\f[R] must be must be a positive integer whose value is 9 or
greater.
.RS
.PP
At run time, where more than one version of a class exists in the JAR,
the JDK will use the first one it finds, searching initially in the
directory tree whose \f[I]VERSION\f[R] number matches the JDK\[aq]s
major version number.
It will then look in directories with successively lower
\f[I]VERSION\f[R] numbers, and finally look in the root of the JAR.
.RE
.TP
\f[V]-v\f[R] or \f[V]--verbose\f[R]
Sends or prints verbose output to standard output.
.SH OPERATION MODIFIERS VALID ONLY IN CREATE AND UPDATE MODES
.PP
You can use the following options to customize the actions of the create
and the update main operation modes:
.TP
\f[V]-e\f[R] \f[I]CLASSNAME\f[R] or \f[V]--main-class=\f[R]\f[I]CLASSNAME\f[R]
Specifies the application entry point for standalone applications
bundled into a modular or executable modular JAR file.
.TP
\f[V]-m\f[R] \f[I]FILE\f[R] or \f[V]--manifest=\f[R]\f[I]FILE\f[R]
Includes the manifest information from the given manifest file.
.TP
\f[V]-M\f[R] or \f[V]--no-manifest\f[R]
Doesn\[aq]t create a manifest file for the entries.
.TP
\f[V]--module-version=\f[R]\f[I]VERSION\f[R]
Specifies the module version, when creating or updating a modular JAR
file, or updating a non-modular JAR file.
.TP
\f[V]--hash-modules=\f[R]\f[I]PATTERN\f[R]
Computes and records the hashes of modules matched by the given pattern
and that depend upon directly or indirectly on a modular JAR file being
created or a non-modular JAR file being updated.
.TP
\f[V]-p\f[R] or \f[V]--module-path\f[R]
Specifies the location of module dependence for generating the hash.
.TP
\f[V]\[at]\f[R]\f[I]file\f[R]
Reads \f[V]jar\f[R] options and file names from a text file as if they
were supplied on the command line
.SH OPERATION MODIFIERS VALID ONLY IN CREATE, UPDATE, AND GENERATE-INDEX MODES
.PP
You can use the following options to customize the actions of the create
(\f[V]-c\f[R] or \f[V]--create\f[R]) the update (\f[V]-u\f[R] or
\f[V]--update\f[R] ) and the generate-index (\f[V]-i\f[R] or
\f[V]--generate-index=\f[R]\f[I]FILE\f[R]) main operation modes:
.TP
\f[V]-0\f[R] or \f[V]--no-compress\f[R]
Stores without using ZIP compression.
.TP
\f[V]--date=\f[R]\f[I]TIMESTAMP\f[R]
The timestamp in ISO-8601 extended offset date-time with optional
time-zone format, to use for the timestamp of the entries, e.g.
\[dq]2022-02-12T12:30:00-05:00\[dq].
.SH OPERATION MODIFIERS VALID ONLY IN EXTRACT MODE
.TP
\f[V]--dir\f[R] \f[I]DIR\f[R]
Directory into which the JAR file will be extracted.
.TP
\f[V]-k\f[R] or \f[V]--keep-old-files\f[R]
Do not overwrite existing files.
If a Jar file entry with the same name exists in the target directory,
the existing file will not be overwritten.
As a result, if a file appears more than once in an archive, later
copies will not overwrite earlier copies.
Also note that some file system can be case insensitive.
.SH OTHER OPTIONS
.PP
The following options are recognized by the \f[V]jar\f[R] command and
not used with operation modes:
.TP
\f[V]-h\f[R] or \f[V]--help\f[R][\f[V]:compat\f[R]]
Displays the command-line help for the \f[V]jar\f[R] command or
optionally the compatibility help.
.TP
\f[V]--help-extra\f[R]
Displays help on extra options.
.TP
\f[V]--version\f[R]
Prints the program version.
.SH EXAMPLES OF JAR COMMAND SYNTAX
.IP \[bu] 2
Create an archive, \f[V]classes.jar\f[R], that contains two class files,
\f[V]Foo.class\f[R] and \f[V]Bar.class\f[R].
.RS 2
.RS
.PP
\f[V]jar --create --file classes.jar Foo.class Bar.class\f[R]
.RE
.RE
.IP \[bu] 2
Create an archive, \f[V]classes.jar\f[R], that contains two class files,
\f[V]Foo.class\f[R] and \f[V]Bar.class\f[R] setting the last modified
date and time to \f[V]2021 Jan 6 12:36:00\f[R].
.RS 2
.RS
.PP
\f[V]jar --create --date=\[dq]2021-01-06T14:36:00+02:00\[dq] --file=classes.jar Foo.class Bar.class\f[R]
.RE
.RE
.IP \[bu] 2
Create an archive, \f[V]classes.jar\f[R], by using an existing manifest,
\f[V]mymanifest\f[R], that contains all of the files in the directory
\f[V]foo/\f[R].
.RS 2
.RS
.PP
\f[V]jar --create --file classes.jar --manifest mymanifest -C foo/\f[R]
.RE
.RE
.IP \[bu] 2
Create a modular JAR archive,\f[V]foo.jar\f[R], where the module
descriptor is located in \f[V]classes/module-info.class\f[R].
.RS 2
.RS
.PP
\f[V]jar --create --file foo.jar --main-class com.foo.Main --module-version 1.0 -C foo/classes resources\f[R]
.RE
.RE
.IP \[bu] 2
Update an existing non-modular JAR, \f[V]foo.jar\f[R], to a modular JAR
file.
.RS 2
.RS
.PP
\f[V]jar --update --file foo.jar --main-class com.foo.Main --module-version 1.0 -C foo/module-info.class\f[R]
.RE
.RE
.IP \[bu] 2
Create a versioned or multi-release JAR, \f[V]foo.jar\f[R], that places
the files in the \f[V]classes\f[R] directory at the root of the JAR, and
the files in the \f[V]classes-10\f[R] directory in the
\f[V]META-INF/versions/10\f[R] directory of the JAR.
.RS 2
.PP
In this example, the \f[V]classes/com/foo\f[R] directory contains two
classes, \f[V]com.foo.Hello\f[R] (the entry point class) and
\f[V]com.foo.NameProvider\f[R], both compiled for JDK 8.
The \f[V]classes-10/com/foo\f[R] directory contains a different version
of the \f[V]com.foo.NameProvider\f[R] class, this one containing JDK 10
specific code and compiled for JDK 10.
.PP
Given this setup, create a multirelease JAR file \f[V]foo.jar\f[R] by
running the following command from the directory containing the
directories \f[V]classes\f[R] and \f[V]classes-10\f[R] .
.RS
.PP
\f[V]jar --create --file foo.jar --main-class com.foo.Hello -C classes . --release 10 -C classes-10 .\f[R]
.RE
.PP
The JAR file \f[V]foo.jar\f[R] now contains:
.IP
.nf
\f[CB]
% jar -tf foo.jar
META-INF/
META-INF/MANIFEST.MF
com/
com/foo/
com/foo/Hello.class
com/foo/NameProvider.class
META-INF/versions/10/com/
META-INF/versions/10/com/foo/
META-INF/versions/10/com/foo/NameProvider.class
\f[R]
.fi
.PP
As well as other information, the file \f[V]META-INF/MANIFEST.MF\f[R],
will contain the following lines to indicate that this is a multirelease
JAR file with an entry point of \f[V]com.foo.Hello\f[R].
.IP
.nf
\f[CB]
\&...
Main-Class: com.foo.Hello
Multi-Release: true
\f[R]
.fi
.PP
Assuming that the \f[V]com.foo.Hello\f[R] class calls a method on the
\f[V]com.foo.NameProvider\f[R] class, running the program using JDK 10
will ensure that the \f[V]com.foo.NameProvider\f[R] class is the one in
\f[V]META-INF/versions/10/com/foo/\f[R].
Running the program using JDK 8 will ensure that the
\f[V]com.foo.NameProvider\f[R] class is the one at the root of the JAR,
in \f[V]com/foo\f[R].
.RE
.IP \[bu] 2
Create an archive, \f[V]my.jar\f[R], by reading options and lists of
class files from the file \f[V]classes.list\f[R].
.RS 2
.PP
\f[B]Note:\f[R]
.PP
To shorten or simplify the \f[V]jar\f[R] command, you can provide an arg
file that lists the files to include in the JAR file and pass it to the
\f[V]jar\f[R] command with the at sign (\f[V]\[at]\f[R]) as a prefix.
.RS
.PP
\f[V]jar --create --file my.jar \[at]classes.list\f[R]
.RE
.PP
If one or more entries in the arg file cannot be found then the jar
command fails without creating the JAR file.
.RE
.IP \[bu] 2
Extract the JAR file \f[V]foo.jar\f[R] to \f[V]/tmp/bar/\f[R] directory:
.RS 2
.RS
.PP
\f[V]jar -xf foo.jar -C /tmp/bar/\f[R]
.RE
.PP
Alternatively, you can also do:
.RS
.PP
\f[V]jar --extract --file foo.jar --dir /tmp/bar/\f[R]
.RE
.RE

View File

@ -0,0 +1,313 @@
---
# Copyright (c) 1997, 2024, 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.
#
title: 'JAR(1) JDK @@VERSION_SHORT@@ | JDK Commands'
date: @@COPYRIGHT_YEAR@@
lang: en
---
## Name
jar - create an archive for classes and resources, and manipulate or restore
individual classes or resources from an archive
## Synopsis
`jar` \[*OPTION* ...\] \[ \[`--release` *VERSION*\] \[`-C` *dir*\] *files*\]
...
## Description
The `jar` command is a general-purpose archiving and compression tool, based on
the ZIP and ZLIB compression formats. Initially, the `jar` command was designed
to package Java applets (not supported since JDK 11) or applications; however,
beginning with JDK 9, users can use the `jar` command to create modular JARs.
For transportation and deployment, it's usually more convenient to package
modules as modular JARs.
The syntax for the `jar` command resembles the syntax for the `tar` command. It
has several main operation modes, defined by one of the mandatory operation
arguments. Other arguments are either options that modify the behavior of the
operation or are required to perform the operation.
When modules or the components of an application (files, images and sounds) are
combined into a single archive, they can be downloaded by a Java agent (such as
a browser) in a single HTTP transaction, rather than requiring a new connection
for each piece. This dramatically improves download times. The `jar` command
also compresses files, which further improves download time. The `jar` command
also enables individual entries in a file to be signed so that their origin can
be authenticated. A JAR file can be used as a class path entry, whether or not
it's compressed.
An archive becomes a modular JAR when you include a module descriptor,
`module-info.class`, in the root of the given directories or in the root of
the `.jar` archive. The following operations described in [Operation Modifiers
Valid Only in Create and Update Modes] are valid only when creating or
updating a modular jar or updating an existing non-modular jar:
- `--module-version`
- `--hash-modules`
- `--module-path`
**Note:**
All mandatory or optional arguments for long options are also mandatory or
optional for any corresponding short options.
## Main Operation Modes
When using the `jar` command, you must specify the operation for it to perform.
You specify the operation mode for the `jar` command by including the
appropriate operation arguments described in this section. You can mix an
operation argument with other one-letter options. Generally the operation
argument is the first argument specified on the command line.
`-c` or `--create`
: Creates the archive.
`-i` *FILE* or `--generate-index=`*FILE*
: Generates index information for the specified JAR file. This option is deprecated
and may be removed in a future release.
`-t` or `--list`
: Lists the table of contents for the archive.
`-u` or `--update`
: Updates an existing JAR file.
`-x` or `--extract`
: Extracts the named (or all) files from the archive.
If a file with the same name appears more than once in
the archive, each copy will be extracted, with later copies
overwriting (replacing) earlier copies unless -k is specified.
`-d` or `--describe-module`
: Prints the module descriptor or automatic module name.
## Operation Modifiers Valid in Any Mode
You can use the following options to customize the actions of any operation
mode included in the `jar` command.
`-C` *DIR*
: When used with the create operation mode, changes the specified directory
and includes the *files* specified at the end of the command line.
`jar` \[*OPTION* ...\] \[ \[`--release` *VERSION*\] \[`-C` *dir*\]
*files*\]
When used with the extract operation mode, specifies the destination directory
where the JAR file will be extracted. Unlike with the create operation mode,
this option can be specified only once with the extract operation mode.
`-f` *FILE* or `--file=`*FILE*
: Specifies the archive file name.
`--release` *VERSION*
: Creates a multirelease JAR file. Places all files specified after the
option into a versioned directory of the JAR file named
`META-INF/versions/`*VERSION*`/`, where *VERSION* must be must be a
positive integer whose value is 9 or greater.
At run time, where more than one version of a class exists in the JAR, the
JDK will use the first one it finds, searching initially in the directory
tree whose *VERSION* number matches the JDK's major version number. It will
then look in directories with successively lower *VERSION* numbers, and
finally look in the root of the JAR.
`-v` or `--verbose`
: Sends or prints verbose output to standard output.
## Operation Modifiers Valid Only in Create and Update Modes
You can use the following options to customize the actions of the create and
the update main operation modes:
`-e` *CLASSNAME* or `--main-class=`*CLASSNAME*
: Specifies the application entry point for standalone applications bundled
into a modular or executable modular JAR file.
`-m` *FILE* or `--manifest=`*FILE*
: Includes the manifest information from the given manifest file.
`-M` or `--no-manifest`
: Doesn't create a manifest file for the entries.
`--module-version=`*VERSION*
: Specifies the module version, when creating or updating a modular JAR file,
or updating a non-modular JAR file.
`--hash-modules=`*PATTERN*
: Computes and records the hashes of modules matched by the given pattern and
that depend upon directly or indirectly on a modular JAR file being created
or a non-modular JAR file being updated.
`-p` or `--module-path`
: Specifies the location of module dependence for generating the hash.
`@`*file*
: Reads `jar` options and file names from a text file as if they were supplied
on the command line
## Operation Modifiers Valid Only in Create, Update, and Generate-index Modes
You can use the following options to customize the actions of the create (`-c`
or `--create`) the update (`-u` or `--update` ) and the generate-index (`-i` or
`--generate-index=`*FILE*) main operation modes:
`-0` or `--no-compress`
: Stores without using ZIP compression.
`--date=`*TIMESTAMP*
: The timestamp in ISO-8601 extended offset date-time with optional time-zone
format, to use for the timestamp of the entries,
e.g. "2022-02-12T12:30:00-05:00".
## Operation Modifiers Valid Only in Extract Mode
`--dir` *DIR*
: Directory into which the JAR file will be extracted.
`-k` or `--keep-old-files`
: Do not overwrite existing files.
If a Jar file entry with the same name exists in the target directory, the
existing file will not be overwritten.
As a result, if a file appears more than once in an archive, later copies will not overwrite
earlier copies.
Also note that some file system can be case insensitive.
## Other Options
The following options are recognized by the `jar` command and not used with
operation modes:
`-h` or `--help`\[`:compat`\]
: Displays the command-line help for the `jar` command or optionally the
compatibility help.
`--help-extra`
: Displays help on extra options.
`--version`
: Prints the program version.
## Examples of jar Command Syntax
- Create an archive, `classes.jar`, that contains two class files,
`Foo.class` and `Bar.class`.
> `jar --create --file classes.jar Foo.class Bar.class`
- Create an archive, `classes.jar`, that contains two class files,
`Foo.class` and `Bar.class` setting the last modified date and time to `2021 Jan 6 12:36:00`.
> `jar --create --date="2021-01-06T14:36:00+02:00" --file=classes.jar Foo.class Bar.class`
- Create an archive, `classes.jar`, by using an existing manifest,
`mymanifest`, that contains all of the files in the directory `foo/`.
> `jar --create --file classes.jar --manifest mymanifest -C foo/`
- Create a modular JAR archive,`foo.jar`, where the module descriptor is
located in `classes/module-info.class`.
> `jar --create --file foo.jar --main-class com.foo.Main
--module-version 1.0 -C foo/classes resources`
- Update an existing non-modular JAR, `foo.jar`, to a modular JAR file.
> `jar --update --file foo.jar --main-class com.foo.Main
--module-version 1.0 -C foo/module-info.class`
- Create a versioned or multi-release JAR, `foo.jar`, that places the files
in the `classes` directory at the root of the JAR, and the files in the
`classes-10` directory in the `META-INF/versions/10` directory of the JAR.
In this example, the `classes/com/foo` directory contains two classes,
`com.foo.Hello` (the entry point class) and `com.foo.NameProvider`, both
compiled for JDK 8. The `classes-10/com/foo` directory contains a different
version of the `com.foo.NameProvider` class, this one containing JDK 10
specific code and compiled for JDK 10.
Given this setup, create a multirelease JAR file `foo.jar` by running the
following command from the directory containing the directories `classes`
and `classes-10` .
> `jar --create --file foo.jar --main-class com.foo.Hello -C classes .
--release 10 -C classes-10 .`
The JAR file `foo.jar` now contains:
```
% jar -tf foo.jar
META-INF/
META-INF/MANIFEST.MF
com/
com/foo/
com/foo/Hello.class
com/foo/NameProvider.class
META-INF/versions/10/com/
META-INF/versions/10/com/foo/
META-INF/versions/10/com/foo/NameProvider.class
```
As well as other information, the file `META-INF/MANIFEST.MF`, will contain
the following lines to indicate that this is a multirelease JAR file with
an entry point of `com.foo.Hello`.
```
...
Main-Class: com.foo.Hello
Multi-Release: true
```
Assuming that the `com.foo.Hello` class calls a method on the
`com.foo.NameProvider` class, running the program using JDK 10 will ensure
that the `com.foo.NameProvider` class is the one in
`META-INF/versions/10/com/foo/`. Running the program using JDK 8 will
ensure that the `com.foo.NameProvider` class is the one at the root of the
JAR, in `com/foo`.
- Create an archive, `my.jar`, by reading options and lists of class files
from the file `classes.list`.
**Note:**
To shorten or simplify the `jar` command, you can provide an arg file that lists
the files to include in the JAR file and pass it to the `jar` command with the at sign (`@`)
as a prefix.
> `jar --create --file my.jar @classes.list`
If one or more entries in the arg file cannot be found then the jar command fails without creating the JAR file.
- Extract the JAR file `foo.jar` to `/tmp/bar/` directory:
> `jar -xf foo.jar -C /tmp/bar/`
Alternatively, you can also do:
> `jar --extract --file foo.jar --dir /tmp/bar/`

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,103 +0,0 @@
.\" Copyright (c) 2004, 2018, 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.19.2
.\"
.\" Define V font for inline verbatim, using C font in formats
.\" that render this, and otherwise B font.
.ie "\f[CB]x\f[R]"x" \{\
. ftr V B
. ftr VI BI
. ftr VB B
. ftr VBI BI
.\}
.el \{\
. ftr V CR
. ftr VI CI
. ftr VB CB
. ftr VBI CBI
.\}
.TH "JINFO" "1" "2025" "JDK 24-ea" "JDK Commands"
.hy
.SH NAME
.PP
jinfo - generate Java configuration information for a specified Java
process
.SH SYNOPSIS
.PP
\f[B]Note:\f[R] This command is experimental and unsupported.
.PP
\f[V]jinfo\f[R] [\f[I]option\f[R]] \f[I]pid\f[R]
.TP
\f[I]option\f[R]
This represents the \f[V]jinfo\f[R] command-line options.
See \f[B]Options for the jinfo Command\f[R].
.TP
\f[I]pid\f[R]
The process ID for which the configuration information is to be printed.
The process must be a Java process.
To get a list of Java processes running on a machine, use either the
\f[V]ps\f[R] command or, if the JVM processes are not running in a
separate docker instance, the \f[B]jps\f[R] command.
.SH DESCRIPTION
.PP
The \f[V]jinfo\f[R] command prints Java configuration information for a
specified Java process.
The configuration information includes Java system properties and JVM
command-line flags.
If the specified process is running on a 64-bit JVM, then you might need
to specify the \f[V]-J-d64\f[R] option, for example:
.RS
.PP
\f[V]jinfo -J-d64 -sysprops\f[R] \f[I]pid\f[R]
.RE
.PP
This command is unsupported and might not be available in future
releases of the JDK.
In Windows Systems where \f[V]dbgeng.dll\f[R] is not present, the
Debugging Tools for Windows must be installed to have these tools work.
The \f[V]PATH\f[R] environment variable should contain the location of
the \f[V]jvm.dll\f[R] that\[aq]s used by the target process or the
location from which the core dump file was produced.
.SH OPTIONS FOR THE JINFO COMMAND
.PP
\f[B]Note:\f[R]
.PP
If none of the following options are used, both the command-line flags
and the system property name-value pairs are printed.
.TP
\f[V]-flag\f[R] \f[I]name\f[R]
Prints the name and value of the specified command-line flag.
.TP
\f[V]-flag\f[R] [\f[V]+\f[R]|\f[V]-\f[R]]\f[I]name\f[R]
Enables or disables the specified Boolean command-line flag.
.TP
\f[V]-flag\f[R] \f[I]name\f[R]\f[V]=\f[R]\f[I]value\f[R]
Sets the specified command-line flag to the specified value.
.TP
\f[V]-flags\f[R]
Prints command-line flags passed to the JVM.
.TP
\f[V]-sysprops\f[R]
Prints Java system properties as name-value pairs.
.TP
\f[V]-h\f[R] or \f[V]-help\f[R]
Prints a help message.

View File

@ -0,0 +1,88 @@
---
# Copyright (c) 2004, 2018, 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.
#
title: 'JINFO(1) JDK @@VERSION_SHORT@@ | JDK Commands'
date: @@COPYRIGHT_YEAR@@
lang: en
---
## Name
jinfo - generate Java configuration information for a specified Java process
## Synopsis
**Note:** This command is experimental and unsupported.
`jinfo` \[*option*\] *pid*
*option*
: This represents the `jinfo` command-line options. See [Options for the
jinfo Command].
*pid*
: The process ID for which the configuration information is to be printed.
The process must be a Java process. To get a list of Java processes running
on a machine, use either the `ps` command or, if the JVM processes are not
running in a separate docker instance, the [jps](jps.html) command.
## Description
The `jinfo` command prints Java configuration information for a specified Java
process. The configuration information includes Java system properties and JVM
command-line flags. If the specified process is running on a 64-bit JVM, then
you might need to specify the `-J-d64` option, for example:
> `jinfo -J-d64 -sysprops` *pid*
This command is unsupported and might not be available in future releases of
the JDK. In Windows Systems where `dbgeng.dll` is not present, the Debugging
Tools for Windows must be installed to have these tools work. The `PATH`
environment variable should contain the location of the `jvm.dll` that's used
by the target process or the location from which the core dump file was
produced.
## Options for the jinfo Command
**Note:**
If none of the following options are used, both the command-line flags and the
system property name-value pairs are printed.
`-flag` *name*
: Prints the name and value of the specified command-line flag.
`-flag` \[`+`\|`-`\]*name*
: Enables or disables the specified Boolean command-line flag.
`-flag` *name*`=`*value*
: Sets the specified command-line flag to the specified value.
`-flags`
: Prints command-line flags passed to the JVM.
`-sysprops`
: Prints Java system properties as name-value pairs.
`-h` or `-help`
: Prints a help message.

View File

@ -1,106 +0,0 @@
.\" Copyright (c) 2004, 2018, 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.19.2
.\"
.\" Define V font for inline verbatim, using C font in formats
.\" that render this, and otherwise B font.
.ie "\f[CB]x\f[R]"x" \{\
. ftr V B
. ftr VI BI
. ftr VB B
. ftr VBI BI
.\}
.el \{\
. ftr V CR
. ftr VI CI
. ftr VB CB
. ftr VBI CBI
.\}
.TH "JMAP" "1" "2025" "JDK 24-ea" "JDK Commands"
.hy
.SH NAME
.PP
jmap - print details of a specified process
.SH SYNOPSIS
.PP
\f[B]Note:\f[R] This command is experimental and unsupported.
.PP
\f[V]jmap\f[R] [\f[I]options\f[R]] \f[I]pid\f[R]
.TP
\f[I]options\f[R]
This represents the \f[V]jmap\f[R] command-line options.
See \f[B]Options for the jmap Command\f[R].
.TP
\f[I]pid\f[R]
The process ID for which the information specified by the
\f[I]options\f[R] is to be printed.
The process must be a Java process.
To get a list of Java processes running on a machine, use either the
\f[V]ps\f[R] command or, if the JVM processes are not running in a
separate docker instance, the \f[B]jps\f[R] command.
.SH DESCRIPTION
.PP
The \f[V]jmap\f[R] command prints details of a specified running
process.
.PP
\f[B]Note:\f[R]
.PP
This command is unsupported and might not be available in future
releases of the JDK.
On Windows Systems where the \f[V]dbgeng.dll\f[R] file isn\[aq]t
present, the Debugging Tools for Windows must be installed to make these
tools work.
The \f[V]PATH\f[R] environment variable should contain the location of
the \f[V]jvm.dll\f[R] file that\[aq]s used by the target process or the
location from which the core dump file was produced.
.SH OPTIONS FOR THE JMAP COMMAND
.TP
\f[V]-clstats\f[R] \f[I]pid\f[R]
Connects to a running process and prints class loader statistics of Java
heap.
.TP
\f[V]-finalizerinfo\f[R] \f[I]pid\f[R]
Connects to a running process and prints information on objects awaiting
finalization.
.TP
\f[V]-histo\f[R][\f[V]:live\f[R]] \f[I]pid\f[R]
Connects to a running process and prints a histogram of the Java object
heap.
If the \f[V]live\f[R] suboption is specified, it then counts only live
objects.
.TP
\f[V]-dump:\f[R]\f[I]dump_options\f[R] \f[I]pid\f[R]
Connects to a running process and dumps the Java heap.
The \f[I]dump_options\f[R] include:
.RS
.IP \[bu] 2
\f[V]live\f[R] --- When specified, dumps only the live objects; if not
specified, then dumps all objects in the heap.
.IP \[bu] 2
\f[V]format=b\f[R] --- Dumps the Java heap in \f[V]hprof\f[R] binary
format
.IP \[bu] 2
\f[V]file=\f[R]\f[I]filename\f[R] --- Dumps the heap to
\f[I]filename\f[R]
.PP
Example: \f[V]jmap -dump:live,format=b,file=heap.bin\f[R] \f[I]pid\f[R]
.RE

View File

@ -0,0 +1,89 @@
---
# Copyright (c) 2004, 2018, 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.
#
title: 'JMAP(1) JDK @@VERSION_SHORT@@ | JDK Commands'
date: @@COPYRIGHT_YEAR@@
lang: en
---
## Name
jmap - print details of a specified process
## Synopsis
**Note:** This command is experimental and unsupported.
`jmap` \[*options*\] *pid*
*options*
: This represents the `jmap` command-line options. See [Options for the jmap
Command].
*pid*
: The process ID for which the information specified by the *options* is to
be printed. The process must be a Java process. To get a list of Java
processes running on a machine, use either the `ps` command or, if the JVM
processes are not running in a separate docker instance, the
[jps](jps.html) command.
## Description
The `jmap` command prints details of a specified running process.
**Note:**
This command is unsupported and might not be available in future releases of
the JDK. On Windows Systems where the `dbgeng.dll` file isn't present, the
Debugging Tools for Windows must be installed to make these tools work. The
`PATH` environment variable should contain the location of the `jvm.dll` file
that's used by the target process or the location from which the core dump file
was produced.
## Options for the jmap Command
`-clstats` *pid*
: Connects to a running process and prints class loader statistics of Java
heap.
`-finalizerinfo` *pid*
: Connects to a running process and prints information on objects awaiting
finalization.
`-histo`\[`:live`\] *pid*
: Connects to a running process and prints a histogram of the Java object
heap. If the `live` suboption is specified, it then counts only live
objects.
`-dump:`*dump\_options* *pid*
: Connects to a running process and dumps the Java heap. The *dump\_options*
include:
- `live` --- When specified, dumps only the live objects; if not
specified, then dumps all objects in the heap.
- `format=b` --- Dumps the Java heap in `hprof` binary format
- `file=`*filename* --- Dumps the heap to *filename*
Example: `jmap -dump:live,format=b,file=heap.bin` *pid*

View File

@ -1,235 +0,0 @@
.\" Copyright (c) 2004, 2018, 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.19.2
.\"
.\" Define V font for inline verbatim, using C font in formats
.\" that render this, and otherwise B font.
.ie "\f[CB]x\f[R]"x" \{\
. ftr V B
. ftr VI BI
. ftr VB B
. ftr VBI BI
.\}
.el \{\
. ftr V CR
. ftr VI CI
. ftr VB CB
. ftr VBI CBI
.\}
.TH "JPS" "1" "2025" "JDK 24-ea" "JDK Commands"
.hy
.SH NAME
.PP
jps - list the instrumented JVMs on the target system
.SH SYNOPSIS
.PP
\f[B]Note:\f[R] This command is experimental and unsupported.
.PP
\f[V]jps\f[R] [\f[V]-q\f[R]] [\f[V]-mlvV\f[R]] [\f[I]hostid\f[R]]
.PP
\f[V]jps\f[R] [\f[V]-help\f[R]]
.SH OPTIONS
.TP
\f[V]-q\f[R]
Suppresses the output of the class name, JAR file name, and arguments
passed to the \f[V]main\f[R] method, producing a list of only local JVM
identifiers.
.TP
\f[V]-mlvV\f[R]
You can specify any combination of these options.
.RS
.IP \[bu] 2
\f[V]-m\f[R] displays the arguments passed to the \f[V]main\f[R] method.
The output may be \f[V]null\f[R] for embedded JVMs.
.IP \[bu] 2
\f[V]-l\f[R] displays the full package name for the application\[aq]s
\f[V]main\f[R] class or the full path name to the application\[aq]s JAR
file.
.IP \[bu] 2
\f[V]-v\f[R] displays the arguments passed to the JVM.
.IP \[bu] 2
\f[V]-V\f[R] suppresses the output of the class name, JAR file name, and
arguments passed to the \f[V]main\f[R] method, producing a list of only
local JVM identifiers.
.RE
.TP
\f[I]hostid\f[R]
The identifier of the host for which the process report should be
generated.
The \f[V]hostid\f[R] can include optional components that indicate the
communications protocol, port number, and other implementation specific
data.
See \f[B]Host Identifier\f[R].
.TP
\f[V]-help\f[R]
Displays the help message for the \f[V]jps\f[R] command.
.SH DESCRIPTION
.PP
The \f[V]jps\f[R] command lists the instrumented Java HotSpot VMs on the
target system.
The command is limited to reporting information on JVMs for which it has
the access permissions.
.PP
If the \f[V]jps\f[R] command is run without specifying a
\f[V]hostid\f[R], then it searches for instrumented JVMs on the local
host.
If started with a \f[V]hostid\f[R], then it searches for JVMs on the
indicated host, using the specified protocol and port.
A \f[V]jstatd\f[R] process is assumed to be running on the target host.
.PP
The \f[V]jps\f[R] command reports the local JVM identifier, or
\f[V]lvmid\f[R], for each instrumented JVM found on the target system.
The \f[V]lvmid\f[R] is typically, but not necessarily, the operating
system\[aq]s process identifier for the JVM process.
With no options, the \f[V]jps\f[R] command lists each Java
application\[aq]s \f[V]lvmid\f[R] followed by the short form of the
application\[aq]s class name or jar file name.
The short form of the class name or JAR file name omits the class\[aq]s
package information or the JAR files path information.
.PP
The \f[V]jps\f[R] command uses the Java launcher to find the class name
and arguments passed to the main method.
If the target JVM is started with a custom launcher, then the class or
JAR file name, and the arguments to the \f[V]main\f[R] method aren\[aq]t
available.
In this case, the \f[V]jps\f[R] command outputs the string
\f[V]Unknown\f[R] for the class name, or JAR file name, and for the
arguments to the \f[V]main\f[R] method.
.PP
The list of JVMs produced by the \f[V]jps\f[R] command can be limited by
the permissions granted to the principal running the command.
The command lists only the JVMs for which the principal has access
rights as determined by operating system-specific access control
mechanisms.
.SH HOST IDENTIFIER
.PP
The host identifier, or \f[V]hostid\f[R], is a string that indicates the
target system.
The syntax of the \f[V]hostid\f[R] string corresponds to the syntax of a
URI:
.RS
.PP
[\f[I]protocol\f[R]\f[V]:\f[R]][[\f[V]//\f[R]]\f[I]hostname\f[R]][\f[V]:\f[R]\f[I]port\f[R]][\f[V]/\f[R]\f[I]servername\f[R]]
.RE
.TP
\f[I]protocol\f[R]
The communications protocol.
If the \f[I]protocol\f[R] is omitted and a \f[I]hostname\f[R] isn\[aq]t
specified, then the default protocol is a platform-specific, optimized,
local protocol.
If the protocol is omitted and a host name is specified, then the
default protocol is \f[V]rmi\f[R].
.TP
\f[I]hostname\f[R]
A host name or IP address that indicates the target host.
If you omit the \f[I]hostname\f[R] parameter, then the target host is
the local host.
.TP
\f[I]port\f[R]
The default port for communicating with the remote server.
If the \f[I]hostname\f[R] parameter is omitted or the \f[I]protocol\f[R]
parameter specifies an optimized, local protocol, then the
\f[I]port\f[R] parameter is ignored.
Otherwise, treatment of the \f[I]port\f[R] parameter is
implementation-specific.
For the default \f[V]rmi\f[R] protocol, the \f[I]port\f[R] parameter
indicates the port number for the \f[V]rmiregistry\f[R] on the remote
host.
If the \f[I]port\f[R] parameter is omitted, and the \f[I]protocol\f[R]
parameter indicates \f[V]rmi\f[R], then the default
\f[V]rmiregistry\f[R] port (\f[V]1099\f[R]) is used.
.TP
\f[I]servername\f[R]
The treatment of this parameter depends on the implementation.
For the optimized, local protocol, this field is ignored.
For the \f[V]rmi\f[R] protocol, this parameter is a string that
represents the name of the RMI remote object on the remote host.
See the \f[B]jstatd\f[R] command \f[V]-n\f[R] option.
.SH OUTPUT FORMAT OF THE JPS COMMAND
.PP
The output of the \f[V]jps\f[R] command has the following pattern:
.RS
.PP
\f[I]lvmid\f[R] [ [ \f[I]classname\f[R] | \f[I]JARfilename\f[R] |
\f[V]\[dq]Unknown\[dq]\f[R]] [ \f[I]arg\f[R]* ] [ \f[I]jvmarg\f[R]* ] ]
.RE
.PP
All output tokens are separated by white space.
An \f[V]arg\f[R] value that includes embedded white space introduces
ambiguity when attempting to map arguments to their actual positional
parameters.
.PP
\f[B]Note:\f[R]
.PP
It\[aq]s recommended that you don\[aq]t write scripts to parse
\f[V]jps\f[R] output because the format might change in future releases.
If you write scripts that parse \f[V]jps\f[R] output, then expect to
modify them for future releases of this tool.
.SH EXAMPLES
.PP
This section provides examples of the \f[V]jps\f[R] command.
.PP
List the instrumented JVMs on the local host:
.IP
.nf
\f[CB]
jps
18027 Java2Demo.JAR
18032 jps
18005 jstat
\f[R]
.fi
.PP
The following example lists the instrumented JVMs on a remote host.
This example assumes that the \f[V]jstat\f[R] server and either the its
internal RMI registry or a separate external \f[V]rmiregistry\f[R]
process are running on the remote host on the default port (port
\f[V]1099\f[R]).
It also assumes that the local host has appropriate permissions to
access the remote host.
This example includes the \f[V]-l\f[R] option to output the long form of
the class names or JAR file names.
.IP
.nf
\f[CB]
jps -l remote.domain
3002 /opt/jdk1.7.0/demo/jfc/Java2D/Java2Demo.JAR
2857 sun.tools.jstatd.jstatd
\f[R]
.fi
.PP
The following example lists the instrumented JVMs on a remote host with
a nondefault port for the RMI registry.
This example assumes that the \f[V]jstatd\f[R] server, with an internal
RMI registry bound to port \f[V]2002\f[R], is running on the remote
host.
This example also uses the \f[V]-m\f[R] option to include the arguments
passed to the \f[V]main\f[R] method of each of the listed Java
applications.
.IP
.nf
\f[CB]
jps -m remote.domain:2002
3002 /opt/jdk1.7.0/demo/jfc/Java2D/Java2Demo.JAR
3102 sun.tools.jstatd.jstatd -p 2002
\f[R]
.fi

View File

@ -0,0 +1,189 @@
---
# Copyright (c) 2004, 2018, 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.
#
title: 'JPS(1) JDK @@VERSION_SHORT@@ | JDK Commands'
date: @@COPYRIGHT_YEAR@@
lang: en
---
## Name
jps - list the instrumented JVMs on the target system
## Synopsis
**Note:** This command is experimental and unsupported.
`jps` \[`-q`\] \[`-mlvV`\] \[*hostid*\]
`jps` \[`-help`\]
## Options
`-q`
: Suppresses the output of the class name, JAR file name, and arguments
passed to the `main` method, producing a list of only local JVM
identifiers.
`-mlvV`
: You can specify any combination of these options.
- `-m` displays the arguments passed to the `main` method. The output may
be `null` for embedded JVMs.
- `-l` displays the full package name for the application's `main` class
or the full path name to the application's JAR file.
- `-v` displays the arguments passed to the JVM.
- `-V` suppresses the output of the class name, JAR file name, and
arguments passed to the `main` method, producing a list of only local
JVM identifiers.
*hostid*
: The identifier of the host for which the process report should be
generated. The `hostid` can include optional components that indicate the
communications protocol, port number, and other implementation specific
data. See [Host Identifier].
`-help`
: Displays the help message for the `jps` command.
## Description
The `jps` command lists the instrumented Java HotSpot VMs on the target system.
The command is limited to reporting information on JVMs for which it has the
access permissions.
If the `jps` command is run without specifying a `hostid`, then it searches for
instrumented JVMs on the local host. If started with a `hostid`, then it
searches for JVMs on the indicated host, using the specified protocol and port.
A `jstatd` process is assumed to be running on the target host.
The `jps` command reports the local JVM identifier, or `lvmid`, for each
instrumented JVM found on the target system. The `lvmid` is typically, but not
necessarily, the operating system's process identifier for the JVM process.
With no options, the `jps` command lists each Java application's `lvmid`
followed by the short form of the application's class name or jar file name.
The short form of the class name or JAR file name omits the class's package
information or the JAR files path information.
The `jps` command uses the Java launcher to find the class name and arguments
passed to the main method. If the target JVM is started with a custom launcher,
then the class or JAR file name, and the arguments to the `main` method aren't
available. In this case, the `jps` command outputs the string `Unknown` for the
class name, or JAR file name, and for the arguments to the `main` method.
The list of JVMs produced by the `jps` command can be limited by the
permissions granted to the principal running the command. The command lists
only the JVMs for which the principal has access rights as determined by
operating system-specific access control mechanisms.
## Host Identifier
The host identifier, or `hostid`, is a string that indicates the target system.
The syntax of the `hostid` string corresponds to the syntax of a URI:
> \[*protocol*`:`\]\[\[`//`\]*hostname*\]\[`:`*port*\]\[`/`*servername*\]
*protocol*
: The communications protocol. If the *protocol* is omitted and a *hostname*
isn't specified, then the default protocol is a platform-specific,
optimized, local protocol. If the protocol is omitted and a host name is
specified, then the default protocol is `rmi`.
*hostname*
: A host name or IP address that indicates the target host. If you omit the
*hostname* parameter, then the target host is the local host.
*port*
: The default port for communicating with the remote server. If the
*hostname* parameter is omitted or the *protocol* parameter specifies an
optimized, local protocol, then the *port* parameter is ignored. Otherwise,
treatment of the *port* parameter is implementation-specific. For the
default `rmi` protocol, the *port* parameter indicates the port number for
the `rmiregistry` on the remote host. If the *port* parameter is omitted,
and the *protocol* parameter indicates `rmi`, then the default
`rmiregistry` port (`1099`) is used.
*servername*
: The treatment of this parameter depends on the implementation. For the
optimized, local protocol, this field is ignored. For the `rmi` protocol,
this parameter is a string that represents the name of the RMI remote
object on the remote host. See the [jstatd](jstatd.html) command `-n`
option.
## Output Format of the jps Command
The output of the `jps` command has the following pattern:
> *lvmid* \[ \[ *classname* \| *JARfilename* \| `"Unknown"`\] \[ *arg*\* \]
\[ *jvmarg*\* \] \]
All output tokens are separated by white space. An `arg` value that includes
embedded white space introduces ambiguity when attempting to map arguments to
their actual positional parameters.
**Note:**
It's recommended that you don't write scripts to parse `jps` output because the
format might change in future releases. If you write scripts that parse `jps`
output, then expect to modify them for future releases of this tool.
## Examples
This section provides examples of the `jps` command.
List the instrumented JVMs on the local host:
```
jps
18027 Java2Demo.JAR
18032 jps
18005 jstat
```
The following example lists the instrumented JVMs on a remote host. This
example assumes that the `jstat` server and either the its internal RMI
registry or a separate external `rmiregistry` process are running on the remote
host on the default port (port `1099`). It also assumes that the local host has
appropriate permissions to access the remote host. This example includes the
`-l` option to output the long form of the class names or JAR file names.
```
jps -l remote.domain
3002 /opt/jdk1.7.0/demo/jfc/Java2D/Java2Demo.JAR
2857 sun.tools.jstatd.jstatd
```
The following example lists the instrumented JVMs on a remote host with a
nondefault port for the RMI registry. This example assumes that the `jstatd`
server, with an internal RMI registry bound to port `2002`, is running on the
remote host. This example also uses the `-m` option to include the arguments
passed to the `main` method of each of the listed Java applications.
```
jps -m remote.domain:2002
3002 /opt/jdk1.7.0/demo/jfc/Java2D/Java2Demo.JAR
3102 sun.tools.jstatd.jstatd -p 2002
```

View File

@ -1,89 +0,0 @@
.\" Copyright (c) 2004, 2018, 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.19.2
.\"
.\" Define V font for inline verbatim, using C font in formats
.\" that render this, and otherwise B font.
.ie "\f[CB]x\f[R]"x" \{\
. ftr V B
. ftr VI BI
. ftr VB B
. ftr VBI BI
.\}
.el \{\
. ftr V CR
. ftr VI CI
. ftr VB CB
. ftr VBI CBI
.\}
.TH "JSTACK" "1" "2025" "JDK 24-ea" "JDK Commands"
.hy
.SH NAME
.PP
jstack - print Java stack traces of Java threads for a specified Java
process
.SH SYNOPSIS
.PP
\f[B]Note:\f[R] This command is experimental and unsupported.
.PP
\f[V]jstack\f[R] [\f[I]options\f[R]] \f[I]pid\f[R]
.TP
\f[I]options\f[R]
This represents the \f[V]jstack\f[R] command-line options.
See \f[B]Options for the jstack Command\f[R].
.TP
\f[I]pid\f[R]
The process ID for which the stack trace is printed.
The process must be a Java process.
To get a list of Java processes running on a machine, use either the
\f[V]ps\f[R] command or, if the JVM processes are not running in a
separate docker instance, the \f[B]jps\f[R] command.
.SH DESCRIPTION
.PP
The \f[V]jstack\f[R] command prints Java stack traces of Java threads
for a specified Java process.
For each Java frame, the full class name, method name, byte code index
(BCI), and line number, when available, are printed.
C++ mangled names aren\[aq]t demangled.
To demangle C++ names, the output of this command can be piped to
\f[V]c++filt\f[R].
When the specified process is running on a 64-bit JVM, you might need to
specify the \f[V]-J-d64\f[R] option, for example:
\f[V]jstack -J-d64\f[R] \f[I]pid\f[R].
.PP
\f[B]Note:\f[R]
.PP
This command is unsupported and might not be available in future
releases of the JDK.
In Windows Systems where the \f[V]dbgeng.dll\f[R] file isn\[aq]t
present, the Debugging Tools for Windows must be installed so that these
tools work.
The \f[V]PATH\f[R] environment variable needs to contain the location of
the \f[V]jvm.dll\f[R] that is used by the target process, or the
location from which the core dump file was produced.
.SH OPTIONS FOR THE JSTACK COMMAND
.TP
\f[V]-l\f[R]
The long listing option prints additional information about locks.
.TP
\f[V]-h\f[R] or \f[V]-help\f[R]
Prints a help message.

View File

@ -0,0 +1,73 @@
---
# Copyright (c) 2004, 2018, 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.
#
title: 'JSTACK(1) JDK @@VERSION_SHORT@@ | JDK Commands'
date: @@COPYRIGHT_YEAR@@
lang: en
---
## Name
jstack - print Java stack traces of Java threads for a specified Java process
## Synopsis
**Note:** This command is experimental and unsupported.
`jstack` \[*options*\] *pid*
*options*
: This represents the `jstack` command-line options. See [Options for the
jstack Command].
*pid*
: The process ID for which the stack trace is printed. The process must be a
Java process. To get a list of Java processes running on a machine, use
either the `ps` command or, if the JVM processes are not running in a
separate docker instance, the [jps](jps.html) command.
## Description
The `jstack` command prints Java stack traces of Java threads for a specified
Java process. For each Java frame, the full class name, method name, byte code
index (BCI), and line number, when available, are printed. C++ mangled names
aren't demangled. To demangle C++ names, the output of this command can be
piped to `c++filt`. When the specified process is running on a 64-bit JVM, you
might need to specify the `-J-d64` option, for example: `jstack -J-d64` *pid*.
**Note:**
This command is unsupported and might not be available in future releases of
the JDK. In Windows Systems where the `dbgeng.dll` file isn't present, the
Debugging Tools for Windows must be installed so that these tools work. The
`PATH` environment variable needs to contain the location of the `jvm.dll` that
is used by the target process, or the location from which the core dump file
was produced.
## Options for the jstack Command
`-l`
: The long listing option prints additional information about locks.
`-h` or `-help`
: Prints a help message.

View File

@ -1,689 +0,0 @@
.\" Copyright (c) 2004, 2023, 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.19.2
.\"
.\" Define V font for inline verbatim, using C font in formats
.\" that render this, and otherwise B font.
.ie "\f[CB]x\f[R]"x" \{\
. ftr V B
. ftr VI BI
. ftr VB B
. ftr VBI BI
.\}
.el \{\
. ftr V CR
. ftr VI CI
. ftr VB CB
. ftr VBI CBI
.\}
.TH "JSTAT" "1" "2025" "JDK 24-ea" "JDK Commands"
.hy
.SH NAME
.PP
jstat - monitor JVM statistics
.SH SYNOPSIS
.PP
\f[B]Note:\f[R] This command is experimental and unsupported.
.PP
\f[V]jstat\f[R] \f[I]generalOptions\f[R]
.PP
\f[V]jstat\f[R] \f[I]outputOptions\f[R] [\f[V]-t\f[R]] [\f[V]-h\f[R]
\f[I]lines\f[R]] \f[I]vmid\f[R] [\f[I]interval\f[R] [\f[I]count\f[R]]]
.TP
\f[I]generalOptions\f[R]
A single general command-line option.
See \f[B]General Options\f[R].
.TP
\f[I]outputOptions\f[R]
An option reported by the \f[V]-options\f[R] option.
One or more output options that consist of a single
\f[V]statOption\f[R], plus any of the \f[V]-t\f[R], \f[V]-h\f[R], and
\f[V]-J\f[R] options.
See \f[B]Output Options for the jstat Command\f[R].
.TP
\f[V]-t\f[R]
Displays a time-stamp column as the first column of output.
The time stamp is the time since the start time of the target JVM.
.TP
\f[V]-h\f[R] \f[I]n\f[R]
Displays a column header every \f[I]n\f[R] samples (output rows), where
\f[I]n\f[R] is a positive integer.
The default value is \f[V]0\f[R], which displays the column header of
the first row of data.
.TP
\f[I]vmid\f[R]
A virtual machine identifier, which is a string that indicates the
target JVM.
See \f[B]Virtual Machine Identifier\f[R].
.TP
\f[I]interval\f[R]
The sampling interval in the specified units, seconds (s) or
milliseconds (ms).
Default units are milliseconds.
This must be a positive integer.
When specified, the \f[V]jstat\f[R] command produces its output at each
interval.
.TP
\f[I]count\f[R]
The number of samples to display.
The default value is infinity, which causes the \f[V]jstat\f[R] command
to display statistics until the target JVM terminates or the
\f[V]jstat\f[R] command is terminated.
This value must be a positive integer.
.SH DESCRIPTION
.PP
The \f[V]jstat\f[R] command displays performance statistics for an
instrumented Java HotSpot VM.
The target JVM is identified by its virtual machine identifier, or
\f[V]vmid\f[R] option.
.PP
The \f[V]jstat\f[R] command supports two types of options, general
options and output options.
General options cause the \f[V]jstat\f[R] command to display simple
usage and version information.
Output options determine the content and format of the statistical
output.
.PP
All options and their functionality are subject to change or removal in
future releases.
.SH GENERAL OPTIONS
.PP
If you specify one of the general options, then you can\[aq]t specify
any other option or parameter.
.TP
\f[V]-help\f[R]
Displays a help message.
.TP
\f[V]-options\f[R]
Displays a list of static options.
See \f[B]Output Options for the jstat Command\f[R].
.SH OUTPUT OPTIONS FOR THE JSTAT COMMAND
.PP
If you don\[aq]t specify a general option, then you can specify output
options.
Output options determine the content and format of the \f[V]jstat\f[R]
command\[aq]s output, and consist of a single \f[V]statOption\f[R], plus
any of the other output options (\f[V]-h\f[R], \f[V]-t\f[R], and
\f[V]-J\f[R]).
The \f[V]statOption\f[R] must come first.
.PP
Output is formatted as a table, with columns that are separated by
spaces.
A header row with titles describes the columns.
Use the \f[V]-h\f[R] option to set the frequency at which the header is
displayed.
Column header names are consistent among the different options.
In general, if two options provide a column with the same name, then the
data source for the two columns is the same.
.PP
Use the \f[V]-t\f[R] option to display a time-stamp column, labeled
Timestamp as the first column of output.
The Timestamp column contains the elapsed time, in seconds, since the
target JVM started.
The resolution of the time stamp is dependent on various factors and is
subject to variation due to delayed thread scheduling on heavily loaded
systems.
.PP
Use the interval and count parameters to determine how frequently and
how many times, respectively, the \f[V]jstat\f[R] command displays its
output.
.PP
\f[B]Note:\f[R]
.PP
Don\[aq]t write scripts to parse the \f[V]jstat\f[R] command\[aq]s
output because the format might change in future releases.
If you write scripts that parse the \f[V]jstat\f[R] command output, then
expect to modify them for future releases of this tool.
.TP
\f[V]-statOption\f[R]
Determines the statistics information that the \f[V]jstat\f[R] command
displays.
The following lists the available options.
Use the \f[V]-options\f[R] general option to display the list of options
for a particular platform installation.
See \f[B]Stat Options and Output\f[R].
.RS
.PP
\f[V]class\f[R]: Displays statistics about the behavior of the class
loader.
.PP
\f[V]compiler\f[R]: Displays statistics about the behavior of the Java
HotSpot VM Just-in-Time compiler.
.PP
\f[V]gc\f[R]: Displays statistics about the behavior of the garbage
collected heap.
.PP
\f[V]gccapacity\f[R]: Displays statistics about the capacities of the
generations and their corresponding spaces.
.PP
\f[V]gccause\f[R]: Displays a summary about garbage collection
statistics (same as \f[V]-gcutil\f[R]), with the cause of the last and
current (when applicable) garbage collection events.
.PP
\f[V]gcnew\f[R]: Displays statistics about the behavior of the new
generation.
.PP
\f[V]gcnewcapacity\f[R]: Displays statistics about the sizes of the new
generations and their corresponding spaces.
.PP
\f[V]gcold\f[R]: Displays statistics about the behavior of the old
generation and metaspace statistics.
.PP
\f[V]gcoldcapacity\f[R]: Displays statistics about the sizes of the old
generation.
.PP
\f[V]gcmetacapacity\f[R]: Displays statistics about the sizes of the
metaspace.
.PP
\f[V]gcutil\f[R]: Displays a summary about garbage collection
statistics.
.PP
\f[V]printcompilation\f[R]: Displays Java HotSpot VM compilation method
statistics.
.RE
.TP
\f[V]-J\f[R]\f[I]javaOption\f[R]
Passes \f[I]javaOption\f[R] to the Java application launcher.
For example, \f[V]-J-Xms48m\f[R] sets the startup memory to 48 MB.
For a complete list of options, see \f[B]java\f[R].
.SH STAT OPTIONS AND OUTPUT
.PP
The following information summarizes the columns that the
\f[V]jstat\f[R] command outputs for each \f[I]statOption\f[R].
.TP
\f[V]-class\f[R] \f[I]option\f[R]
Class loader statistics.
.RS
.PP
\f[V]Loaded\f[R]: Number of classes loaded.
.PP
\f[V]Bytes\f[R]: Number of KB loaded.
.PP
\f[V]Unloaded\f[R]: Number of classes unloaded.
.PP
\f[V]Bytes\f[R]: Number of KB unloaded.
.PP
\f[V]Time\f[R]: Time spent performing class loading and unloading
operations.
.RE
.TP
\f[V]-compiler\f[R] \f[I]option\f[R]
Java HotSpot VM Just-in-Time compiler statistics.
.RS
.PP
\f[V]Compiled\f[R]: Number of compilation tasks performed.
.PP
\f[V]Failed\f[R]: Number of compilations tasks failed.
.PP
\f[V]Invalid\f[R]: Number of compilation tasks that were invalidated.
.PP
\f[V]Time\f[R]: Time spent performing compilation tasks.
.PP
\f[V]FailedType\f[R]: Compile type of the last failed compilation.
.PP
\f[V]FailedMethod\f[R]: Class name and method of the last failed
compilation.
.RE
.TP
\f[V]-gc\f[R] \f[I]option\f[R]
Garbage collected heap statistics.
.RS
.PP
\f[V]S0C\f[R]: Current survivor space 0 capacity (KB).
.PP
\f[V]S1C\f[R]: Current survivor space 1 capacity (KB).
.PP
\f[V]S0U\f[R]: Survivor space 0 utilization (KB).
.PP
\f[V]S1U\f[R]: Survivor space 1 utilization (KB).
.PP
\f[V]EC\f[R]: Current eden space capacity (KB).
.PP
\f[V]EU\f[R]: Eden space utilization (KB).
.PP
\f[V]OC\f[R]: Current old space capacity (KB).
.PP
\f[V]OU\f[R]: Old space utilization (KB).
.PP
\f[V]MC\f[R]: Metaspace Committed Size (KB).
.PP
\f[V]MU\f[R]: Metaspace utilization (KB).
.PP
\f[V]CCSC\f[R]: Compressed class committed size (KB).
.PP
\f[V]CCSU\f[R]: Compressed class space used (KB).
.PP
\f[V]YGC\f[R]: Number of young generation garbage collection (GC)
events.
.PP
\f[V]YGCT\f[R]: Young generation garbage collection time.
.PP
\f[V]FGC\f[R]: Number of full GC events.
.PP
\f[V]FGCT\f[R]: Full garbage collection time.
.PP
\f[V]GCT\f[R]: Total garbage collection time.
.RE
.TP
\f[V]-gccapacity\f[R] \f[I]option\f[R]
Memory pool generation and space capacities.
.RS
.PP
\f[V]NGCMN\f[R]: Minimum new generation capacity (KB).
.PP
\f[V]NGCMX\f[R]: Maximum new generation capacity (KB).
.PP
\f[V]NGC\f[R]: Current new generation capacity (KB).
.PP
\f[V]S0C\f[R]: Current survivor space 0 capacity (KB).
.PP
\f[V]S1C\f[R]: Current survivor space 1 capacity (KB).
.PP
\f[V]EC\f[R]: Current eden space capacity (KB).
.PP
\f[V]OGCMN\f[R]: Minimum old generation capacity (KB).
.PP
\f[V]OGCMX\f[R]: Maximum old generation capacity (KB).
.PP
\f[V]OGC\f[R]: Current old generation capacity (KB).
.PP
\f[V]OC\f[R]: Current old space capacity (KB).
.PP
\f[V]MCMN\f[R]: Minimum metaspace capacity (KB).
.PP
\f[V]MCMX\f[R]: Maximum metaspace capacity (KB).
.PP
\f[V]MC\f[R]: Metaspace Committed Size (KB).
.PP
\f[V]CCSMN\f[R]: Compressed class space minimum capacity (KB).
.PP
\f[V]CCSMX\f[R]: Compressed class space maximum capacity (KB).
.PP
\f[V]CCSC\f[R]: Compressed class committed size (KB).
.PP
\f[V]YGC\f[R]: Number of young generation GC events.
.PP
\f[V]FGC\f[R]: Number of full GC events.
.RE
.TP
\f[V]-gccause\f[R] \f[I]option\f[R]
This option displays the same summary of garbage collection statistics
as the \f[V]-gcutil\f[R] option, but includes the causes of the last
garbage collection event and (when applicable), the current garbage
collection event.
In addition to the columns listed for \f[V]-gcutil\f[R], this option
adds the following columns:
.RS
.PP
\f[V]LGCC\f[R]: Cause of last garbage collection
.PP
\f[V]GCC\f[R]: Cause of current garbage collection
.RE
.TP
\f[V]-gcnew\f[R] \f[I]option\f[R]
New generation statistics.
.RS
.PP
\f[V]S0C\f[R]: Current survivor space 0 capacity (KB).
.PP
\f[V]S1C\f[R]: Current survivor space 1 capacity (KB).
.PP
\f[V]S0U\f[R]: Survivor space 0 utilization (KB).
.PP
\f[V]S1U\f[R]: Survivor space 1 utilization (KB).
.PP
\f[V]TT\f[R]: Tenuring threshold.
.PP
\f[V]MTT\f[R]: Maximum tenuring threshold.
.PP
\f[V]DSS\f[R]: Desired survivor size (KB).
.PP
\f[V]EC\f[R]: Current eden space capacity (KB).
.PP
\f[V]EU\f[R]: Eden space utilization (KB).
.PP
\f[V]YGC\f[R]: Number of young generation GC events.
.PP
\f[V]YGCT\f[R]: Young generation garbage collection time.
.RE
.TP
\f[V]-gcnewcapacity\f[R] \f[I]option\f[R]
New generation space size statistics.
.RS
.PP
\f[V]NGCMN\f[R]: Minimum new generation capacity (KB).
.PP
\f[V]NGCMX\f[R]: Maximum new generation capacity (KB).
.PP
\f[V]NGC\f[R]: Current new generation capacity (KB).
.PP
\f[V]S0CMX\f[R]: Maximum survivor space 0 capacity (KB).
.PP
\f[V]S0C\f[R]: Current survivor space 0 capacity (KB).
.PP
\f[V]S1CMX\f[R]: Maximum survivor space 1 capacity (KB).
.PP
\f[V]S1C\f[R]: Current survivor space 1 capacity (KB).
.PP
\f[V]ECMX\f[R]: Maximum eden space capacity (KB).
.PP
\f[V]EC\f[R]: Current eden space capacity (KB).
.PP
\f[V]YGC\f[R]: Number of young generation GC events.
.PP
\f[V]FGC\f[R]: Number of full GC events.
.RE
.TP
\f[V]-gcold\f[R] \f[I]option\f[R]
Old generation size statistics.
.RS
.PP
\f[V]MC\f[R]: Metaspace Committed Size (KB).
.PP
\f[V]MU\f[R]: Metaspace utilization (KB).
.PP
\f[V]CCSC\f[R]: Compressed class committed size (KB).
.PP
\f[V]CCSU\f[R]: Compressed class space used (KB).
.PP
\f[V]OC\f[R]: Current old space capacity (KB).
.PP
\f[V]OU\f[R]: Old space utilization (KB).
.PP
\f[V]YGC\f[R]: Number of young generation GC events.
.PP
\f[V]FGC\f[R]: Number of full GC events.
.PP
\f[V]FGCT\f[R]: Full garbage collection time.
.PP
\f[V]GCT\f[R]: Total garbage collection time.
.RE
.TP
\f[V]-gcoldcapacity\f[R] \f[I]option\f[R]
Old generation statistics.
.RS
.PP
\f[V]OGCMN\f[R]: Minimum old generation capacity (KB).
.PP
\f[V]OGCMX\f[R]: Maximum old generation capacity (KB).
.PP
\f[V]OGC\f[R]: Current old generation capacity (KB).
.PP
\f[V]OC\f[R]: Current old space capacity (KB).
.PP
\f[V]YGC\f[R]: Number of young generation GC events.
.PP
\f[V]FGC\f[R]: Number of full GC events.
.PP
\f[V]FGCT\f[R]: Full garbage collection time.
.PP
\f[V]GCT\f[R]: Total garbage collection time.
.RE
.TP
\f[V]-gcmetacapacity\f[R] \f[I]option\f[R]
Metaspace size statistics.
.RS
.PP
\f[V]MCMN\f[R]: Minimum metaspace capacity (KB).
.PP
\f[V]MCMX\f[R]: Maximum metaspace capacity (KB).
.PP
\f[V]MC\f[R]: Metaspace Committed Size (KB).
.PP
\f[V]CCSMN\f[R]: Compressed class space minimum capacity (KB).
.PP
\f[V]CCSMX\f[R]: Compressed class space maximum capacity (KB).
.PP
\f[V]YGC\f[R]: Number of young generation GC events.
.PP
\f[V]FGC\f[R]: Number of full GC events.
.PP
\f[V]FGCT\f[R]: Full garbage collection time.
.PP
\f[V]GCT\f[R]: Total garbage collection time.
.RE
.TP
\f[V]-gcutil\f[R] \f[I]option\f[R]
Summary of garbage collection statistics.
.RS
.PP
\f[V]S0\f[R]: Survivor space 0 utilization as a percentage of the
space\[aq]s current capacity.
.PP
\f[V]S1\f[R]: Survivor space 1 utilization as a percentage of the
space\[aq]s current capacity.
.PP
\f[V]E\f[R]: Eden space utilization as a percentage of the space\[aq]s
current capacity.
.PP
\f[V]O\f[R]: Old space utilization as a percentage of the space\[aq]s
current capacity.
.PP
\f[V]M\f[R]: Metaspace utilization as a percentage of the space\[aq]s
current capacity.
.PP
\f[V]CCS\f[R]: Compressed class space utilization as a percentage.
.PP
\f[V]YGC\f[R]: Number of young generation GC events.
.PP
\f[V]YGCT\f[R]: Young generation garbage collection time.
.PP
\f[V]FGC\f[R]: Number of full GC events.
.PP
\f[V]FGCT\f[R]: Full garbage collection time.
.PP
\f[V]GCT\f[R]: Total garbage collection time.
.RE
.TP
\f[V]-printcompilation\f[R] \f[I]option\f[R]
Java HotSpot VM compiler method statistics.
.RS
.PP
\f[V]Compiled\f[R]: Number of compilation tasks performed by the most
recently compiled method.
.PP
\f[V]Size\f[R]: Number of bytes of byte code of the most recently
compiled method.
.PP
\f[V]Type\f[R]: Compilation type of the most recently compiled method.
.PP
\f[V]Method\f[R]: Class name and method name identifying the most
recently compiled method.
Class name uses a slash (/) instead of a dot (.)
as a name space separator.
The method name is the method within the specified class.
The format for these two fields is consistent with the HotSpot
\f[V]-XX:+PrintCompilation\f[R] option.
.RE
.SH VIRTUAL MACHINE IDENTIFIER
.PP
The syntax of the \f[V]vmid\f[R] string corresponds to the syntax of a
URI:
.RS
.PP
[\f[I]protocol\f[R]\f[V]:\f[R]][\f[V]//\f[R]]\f[I]lvmid\f[R][\f[V]\[at]\f[R]\f[I]hostname\f[R][\f[V]:\f[R]\f[I]port\f[R]][\f[V]/\f[R]\f[I]servername\f[R]]
.RE
.PP
The syntax of the \f[V]vmid\f[R] string corresponds to the syntax of a
URI.
The \f[V]vmid\f[R] string can vary from a simple integer that represents
a local JVM to a more complex construction that specifies a
communications protocol, port number, and other implementation-specific
values.
.TP
\f[I]protocol\f[R]
The communications protocol.
If the \f[I]protocol\f[R] value is omitted and a host name isn\[aq]t
specified, then the default protocol is a platform-specific optimized
local protocol.
If the \f[I]protocol\f[R] value is omitted and a host name is specified,
then the default protocol is \f[V]rmi\f[R].
.TP
\f[I]lvmid\f[R]
The local virtual machine identifier for the target JVM.
The \f[I]lvmid\f[R] is a platform-specific value that uniquely
identifies a JVM on a system.
The \f[I]lvmid\f[R] is the only required component of a virtual machine
identifier.
The \f[I]lvmid\f[R] is typically, but not necessarily, the operating
system\[aq]s process identifier for the target JVM process.
You can use the \f[V]jps\f[R] command to determine the \f[I]lvmid\f[R]
provided the JVM processes is not running in a separate docker instance.
You can also determine the \f[I]lvmid\f[R] on Linux and macOS platforms
with the \f[V]ps\f[R] command, and on Windows with the Windows Task
Manager.
.TP
\f[I]hostname\f[R]
A host name or IP address that indicates the target host.
If the \f[I]hostname\f[R] value is omitted, then the target host is the
local host.
.TP
\f[I]port\f[R]
The default port for communicating with the remote server.
If the \f[I]hostname\f[R] value is omitted or the \f[I]protocol\f[R]
value specifies an optimized, local protocol, then the \f[I]port\f[R]
value is ignored.
Otherwise, treatment of the \f[I]port\f[R] parameter is
implementation-specific.
For the default \f[V]rmi\f[R] protocol, the port value indicates the
port number for the \f[V]rmiregistry\f[R] on the remote host.
If the \f[I]port\f[R] value is omitted and the \f[I]protocol\f[R] value
indicates \f[V]rmi\f[R], then the default rmiregistry port (1099) is
used.
.TP
\f[I]servername\f[R]
The treatment of the \f[I]servername\f[R] parameter depends on
implementation.
For the optimized local protocol, this field is ignored.
For the \f[V]rmi\f[R] protocol, it represents the name of the RMI remote
object on the remote host.
.SH EXAMPLES
.PP
This section presents some examples of monitoring a local JVM with an
\f[I]lvmid\f[R] of 21891.
.SH THE GCUTIL OPTION
.PP
This example attaches to lvmid 21891 and takes 7 samples at 250
millisecond intervals and displays the output as specified by the
\f[V]-gcutil\f[R] option.
.PP
The output of this example shows that a young generation collection
occurred between the third and fourth sample.
The collection took 0.078 seconds and promoted objects from the eden
space (E) to the old space (O), resulting in an increase of old space
utilization from 66.80% to 68.19%.
Before the collection, the survivor space was 97.02% utilized, but after
this collection it\[aq]s 91.03% utilized.
.IP
.nf
\f[CB]
jstat -gcutil 21891 250 7
S0 S1 E O M CCS YGC YGCT FGC FGCT GCT
0.00 97.02 70.31 66.80 95.52 89.14 7 0.300 0 0.000 0.300
0.00 97.02 86.23 66.80 95.52 89.14 7 0.300 0 0.000 0.300
0.00 97.02 96.53 66.80 95.52 89.14 7 0.300 0 0.000 0.300
91.03 0.00 1.98 68.19 95.89 91.24 8 0.378 0 0.000 0.378
91.03 0.00 15.82 68.19 95.89 91.24 8 0.378 0 0.000 0.378
91.03 0.00 17.80 68.19 95.89 91.24 8 0.378 0 0.000 0.378
91.03 0.00 17.80 68.19 95.89 91.24 8 0.378 0 0.000 0.378
\f[R]
.fi
.SH REPEAT THE COLUMN HEADER STRING
.PP
This example attaches to lvmid 21891 and takes samples at 250
millisecond intervals and displays the output as specified by
\f[V]-gcnew\f[R] option.
In addition, it uses the \f[V]-h3\f[R] option to output the column
header after every 3 lines of data.
.PP
In addition to showing the repeating header string, this example shows
that between the second and third samples, a young GC occurred.
Its duration was 0.001 seconds.
The collection found enough active data that the survivor space 0
utilization (S0U) would have exceeded the desired survivor size (DSS).
As a result, objects were promoted to the old generation (not visible in
this output), and the tenuring threshold (TT) was lowered from 31 to 2.
.PP
Another collection occurs between the fifth and sixth samples.
This collection found very few survivors and returned the tenuring
threshold to 31.
.IP
.nf
\f[CB]
jstat -gcnew -h3 21891 250
S0C S1C S0U S1U TT MTT DSS EC EU YGC YGCT
64.0 64.0 0.0 31.7 31 31 32.0 512.0 178.6 249 0.203
64.0 64.0 0.0 31.7 31 31 32.0 512.0 355.5 249 0.203
64.0 64.0 35.4 0.0 2 31 32.0 512.0 21.9 250 0.204
S0C S1C S0U S1U TT MTT DSS EC EU YGC YGCT
64.0 64.0 35.4 0.0 2 31 32.0 512.0 245.9 250 0.204
64.0 64.0 35.4 0.0 2 31 32.0 512.0 421.1 250 0.204
64.0 64.0 0.0 19.0 31 31 32.0 512.0 84.4 251 0.204
S0C S1C S0U S1U TT MTT DSS EC EU YGC YGCT
64.0 64.0 0.0 19.0 31 31 32.0 512.0 306.7 251 0.204
\f[R]
.fi
.SH INCLUDE A TIME STAMP FOR EACH SAMPLE
.PP
This example attaches to lvmid 21891 and takes 3 samples at 250
millisecond intervals.
The \f[V]-t\f[R] option is used to generate a time stamp for each sample
in the first column.
.PP
The Timestamp column reports the elapsed time in seconds since the start
of the target JVM.
In addition, the \f[V]-gcoldcapacity\f[R] output shows the old
generation capacity (OGC) and the old space capacity (OC) increasing as
the heap expands to meet allocation or promotion demands.
The old generation capacity (OGC) has grown from 11,696 KB to 13,820 KB
after the eighty-first full garbage collection (FGC).
The maximum capacity of the generation (and space) is 60,544 KB (OGCMX),
so it still has room to expand.
.IP
.nf
\f[CB]
Timestamp OGCMN OGCMX OGC OC YGC FGC FGCT GCT
150.1 1408.0 60544.0 11696.0 11696.0 194 80 2.874 3.799
150.4 1408.0 60544.0 13820.0 13820.0 194 81 2.938 3.863
150.7 1408.0 60544.0 13820.0 13820.0 194 81 2.938 3.863
\f[R]
.fi
.SH MONITOR INSTRUMENTATION FOR A REMOTE JVM
.PP
This example attaches to lvmid 40496 on the system named
\f[V]remote.domain\f[R] using the \f[V]-gcutil\f[R] option, with samples
taken every second indefinitely.
.PP
The lvmid is combined with the name of the remote host to construct a
vmid of \f[V]40496\[at]remote.domain\f[R].
This vmid results in the use of the \f[V]rmi\f[R] protocol to
communicate to the default \f[V]jstatd\f[R] server on the remote host.
The \f[V]jstatd\f[R] server is located using the \f[V]rmiregistry\f[R]
command on \f[V]remote.domain\f[R] that\[aq]s bound to the default port
of the \f[V]rmiregistry\f[R] command (port 1099).
.IP
.nf
\f[CB]
jstat -gcutil 40496\[at]remote.domain 1000
\&... output omitted
\f[R]
.fi

View File

@ -0,0 +1,588 @@
---
# Copyright (c) 2004, 2023, 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.
#
title: 'JSTAT(1) JDK @@VERSION_SHORT@@ | JDK Commands'
date: @@COPYRIGHT_YEAR@@
lang: en
---
## Name
jstat - monitor JVM statistics
## Synopsis
**Note:** This command is experimental and unsupported.
`jstat` *generalOptions*
`jstat` *outputOptions* \[`-t`\] \[`-h` *lines*\] *vmid* \[*interval*
\[*count*\]\]
*generalOptions*
: A single general command-line option. See [General Options].
*outputOptions*
: An option reported by the `-options` option. One or more output options
that consist of a single `statOption`, plus any of the `-t`, `-h`, and `-J`
options. See [Output Options for the jstat Command].
`-t`
: Displays a time-stamp column as the first column of output. The time stamp
is the time since the start time of the target JVM.
`-h` *n*
: Displays a column header every *n* samples (output rows), where *n* is a
positive integer. The default value is `0`, which displays the column
header of the first row of data.
*vmid*
: A virtual machine identifier, which is a string that indicates the target
JVM. See [Virtual Machine Identifier].
*interval*
: The sampling interval in the specified units, seconds (s) or milliseconds
(ms). Default units are milliseconds. This must be a positive integer. When
specified, the `jstat` command produces its output at each interval.
*count*
: The number of samples to display. The default value is infinity, which
causes the `jstat` command to display statistics until the target JVM
terminates or the `jstat` command is terminated. This value must be a
positive integer.
## Description
The `jstat` command displays performance statistics for an instrumented Java
HotSpot VM. The target JVM is identified by its virtual machine identifier, or
`vmid` option.
The `jstat` command supports two types of options, general options and output
options. General options cause the `jstat` command to display simple usage and
version information. Output options determine the content and format of the
statistical output.
All options and their functionality are subject to change or removal in future
releases.
## General Options
If you specify one of the general options, then you can't specify any other
option or parameter.
`-help`
: Displays a help message.
`-options`
: Displays a list of static options. See [Output Options for the jstat
Command].
## Output Options for the jstat Command
If you don't specify a general option, then you can specify output options.
Output options determine the content and format of the `jstat` command's
output, and consist of a single `statOption`, plus any of the other output
options (`-h`, `-t`, and `-J`). The `statOption` must come first.
Output is formatted as a table, with columns that are separated by spaces. A
header row with titles describes the columns. Use the `-h` option to set the
frequency at which the header is displayed. Column header names are consistent
among the different options. In general, if two options provide a column with
the same name, then the data source for the two columns is the same.
Use the `-t` option to display a time-stamp column, labeled Timestamp as the
first column of output. The Timestamp column contains the elapsed time, in
seconds, since the target JVM started. The resolution of the time stamp is
dependent on various factors and is subject to variation due to delayed thread
scheduling on heavily loaded systems.
Use the interval and count parameters to determine how frequently and how many
times, respectively, the `jstat` command displays its output.
**Note:**
Don't write scripts to parse the `jstat` command's output because the format
might change in future releases. If you write scripts that parse the `jstat`
command output, then expect to modify them for future releases of this tool.
`-statOption`
: Determines the statistics information that the `jstat` command displays.
The following lists the available options. Use the `-options` general
option to display the list of options for a particular platform
installation. See [Stat Options and Output].
`class`: Displays statistics about the behavior of the class loader.
`compiler`: Displays statistics about the behavior of the Java HotSpot VM
Just-in-Time compiler.
`gc`: Displays statistics about the behavior of the garbage collected heap.
`gccapacity`: Displays statistics about the capacities of the generations
and their corresponding spaces.
`gccause`: Displays a summary about garbage collection statistics (same as
`-gcutil`), with the cause of the last and current (when applicable)
garbage collection events.
`gcnew`: Displays statistics about the behavior of the new generation.
`gcnewcapacity`: Displays statistics about the sizes of the new generations
and their corresponding spaces.
`gcold`: Displays statistics about the behavior of the old generation and
metaspace statistics.
`gcoldcapacity`: Displays statistics about the sizes of the old generation.
`gcmetacapacity`: Displays statistics about the sizes of the metaspace.
`gcutil`: Displays a summary about garbage collection statistics.
`printcompilation`: Displays Java HotSpot VM compilation method statistics.
`-J`*javaOption*
: Passes *javaOption* to the Java application launcher. For example,
`-J-Xms48m` sets the startup memory to 48 MB. For a complete list of
options, see [java](java.html).
## Stat Options and Output
The following information summarizes the columns that the `jstat` command
outputs for each *statOption*.
`-class` *option*
: Class loader statistics.
`Loaded`: Number of classes loaded.
`Bytes`: Number of KB loaded.
`Unloaded`: Number of classes unloaded.
`Bytes`: Number of KB unloaded.
`Time`: Time spent performing class loading and unloading operations.
`-compiler` *option*
: Java HotSpot VM Just-in-Time compiler statistics.
`Compiled`: Number of compilation tasks performed.
`Failed`: Number of compilations tasks failed.
`Invalid`: Number of compilation tasks that were invalidated.
`Time`: Time spent performing compilation tasks.
`FailedType`: Compile type of the last failed compilation.
`FailedMethod`: Class name and method of the last failed compilation.
`-gc` *option*
: Garbage collected heap statistics.
`S0C`: Current survivor space 0 capacity (KB).
`S1C`: Current survivor space 1 capacity (KB).
`S0U`: Survivor space 0 utilization (KB).
`S1U`: Survivor space 1 utilization (KB).
`EC`: Current eden space capacity (KB).
`EU`: Eden space utilization (KB).
`OC`: Current old space capacity (KB).
`OU`: Old space utilization (KB).
`MC`: Metaspace Committed Size (KB).
`MU`: Metaspace utilization (KB).
`CCSC`: Compressed class committed size (KB).
`CCSU`: Compressed class space used (KB).
`YGC`: Number of young generation garbage collection (GC) events.
`YGCT`: Young generation garbage collection time.
`FGC`: Number of full GC events.
`FGCT`: Full garbage collection time.
`GCT`: Total garbage collection time.
`-gccapacity` *option*
: Memory pool generation and space capacities.
`NGCMN`: Minimum new generation capacity (KB).
`NGCMX`: Maximum new generation capacity (KB).
`NGC`: Current new generation capacity (KB).
`S0C`: Current survivor space 0 capacity (KB).
`S1C`: Current survivor space 1 capacity (KB).
`EC`: Current eden space capacity (KB).
`OGCMN`: Minimum old generation capacity (KB).
`OGCMX`: Maximum old generation capacity (KB).
`OGC`: Current old generation capacity (KB).
`OC`: Current old space capacity (KB).
`MCMN`: Minimum metaspace capacity (KB).
`MCMX`: Maximum metaspace capacity (KB).
`MC`: Metaspace Committed Size (KB).
`CCSMN`: Compressed class space minimum capacity (KB).
`CCSMX`: Compressed class space maximum capacity (KB).
`CCSC`: Compressed class committed size (KB).
`YGC`: Number of young generation GC events.
`FGC`: Number of full GC events.
`-gccause` *option*
: This option displays the same summary of garbage collection statistics as
the `-gcutil` option, but includes the causes of the last garbage
collection event and (when applicable), the current garbage collection
event. In addition to the columns listed for `-gcutil`, this option adds
the following columns:
`LGCC`: Cause of last garbage collection
`GCC`: Cause of current garbage collection
`-gcnew` *option*
: New generation statistics.
`S0C`: Current survivor space 0 capacity (KB).
`S1C`: Current survivor space 1 capacity (KB).
`S0U`: Survivor space 0 utilization (KB).
`S1U`: Survivor space 1 utilization (KB).
`TT`: Tenuring threshold.
`MTT`: Maximum tenuring threshold.
`DSS`: Desired survivor size (KB).
`EC`: Current eden space capacity (KB).
`EU`: Eden space utilization (KB).
`YGC`: Number of young generation GC events.
`YGCT`: Young generation garbage collection time.
`-gcnewcapacity` *option*
: New generation space size statistics.
`NGCMN`: Minimum new generation capacity (KB).
`NGCMX`: Maximum new generation capacity (KB).
`NGC`: Current new generation capacity (KB).
`S0CMX`: Maximum survivor space 0 capacity (KB).
`S0C`: Current survivor space 0 capacity (KB).
`S1CMX`: Maximum survivor space 1 capacity (KB).
`S1C`: Current survivor space 1 capacity (KB).
`ECMX`: Maximum eden space capacity (KB).
`EC`: Current eden space capacity (KB).
`YGC`: Number of young generation GC events.
`FGC`: Number of full GC events.
`-gcold` *option*
: Old generation size statistics.
`MC`: Metaspace Committed Size (KB).
`MU`: Metaspace utilization (KB).
`CCSC`: Compressed class committed size (KB).
`CCSU`: Compressed class space used (KB).
`OC`: Current old space capacity (KB).
`OU`: Old space utilization (KB).
`YGC`: Number of young generation GC events.
`FGC`: Number of full GC events.
`FGCT`: Full garbage collection time.
`GCT`: Total garbage collection time.
`-gcoldcapacity` *option*
: Old generation statistics.
`OGCMN`: Minimum old generation capacity (KB).
`OGCMX`: Maximum old generation capacity (KB).
`OGC`: Current old generation capacity (KB).
`OC`: Current old space capacity (KB).
`YGC`: Number of young generation GC events.
`FGC`: Number of full GC events.
`FGCT`: Full garbage collection time.
`GCT`: Total garbage collection time.
`-gcmetacapacity` *option*
: Metaspace size statistics.
`MCMN`: Minimum metaspace capacity (KB).
`MCMX`: Maximum metaspace capacity (KB).
`MC`: Metaspace Committed Size (KB).
`CCSMN`: Compressed class space minimum capacity (KB).
`CCSMX`: Compressed class space maximum capacity (KB).
`YGC`: Number of young generation GC events.
`FGC`: Number of full GC events.
`FGCT`: Full garbage collection time.
`GCT`: Total garbage collection time.
`-gcutil` *option*
: Summary of garbage collection statistics.
`S0`: Survivor space 0 utilization as a percentage of the space's current
capacity.
`S1`: Survivor space 1 utilization as a percentage of the space's current
capacity.
`E`: Eden space utilization as a percentage of the space's current
capacity.
`O`: Old space utilization as a percentage of the space's current capacity.
`M`: Metaspace utilization as a percentage of the space's current capacity.
`CCS`: Compressed class space utilization as a percentage.
`YGC`: Number of young generation GC events.
`YGCT`: Young generation garbage collection time.
`FGC`: Number of full GC events.
`FGCT`: Full garbage collection time.
`GCT`: Total garbage collection time.
`-printcompilation` *option*
: Java HotSpot VM compiler method statistics.
`Compiled`: Number of compilation tasks performed by the most recently
compiled method.
`Size`: Number of bytes of byte code of the most recently compiled method.
`Type`: Compilation type of the most recently compiled method.
`Method`: Class name and method name identifying the most recently compiled
method. Class name uses a slash (/) instead of a dot (.) as a name space
separator. The method name is the method within the specified class. The
format for these two fields is consistent with the HotSpot
`-XX:+PrintCompilation` option.
## Virtual Machine Identifier
The syntax of the `vmid` string corresponds to the syntax of a URI:
> \[*protocol*`:`\]\[`//`\]*lvmid*\[`@`*hostname*\[`:`*port*\]\[`/`*servername*\]
The syntax of the `vmid` string corresponds to the syntax of a URI. The `vmid`
string can vary from a simple integer that represents a local JVM to a more
complex construction that specifies a communications protocol, port number, and
other implementation-specific values.
*protocol*
: The communications protocol. If the *protocol* value is omitted and a host
name isn't specified, then the default protocol is a platform-specific
optimized local protocol. If the *protocol* value is omitted and a host
name is specified, then the default protocol is `rmi`.
*lvmid*
: The local virtual machine identifier for the target JVM. The *lvmid* is a
platform-specific value that uniquely identifies a JVM on a system. The
*lvmid* is the only required component of a virtual machine identifier. The
*lvmid* is typically, but not necessarily, the operating system's process
identifier for the target JVM process. You can use the `jps` command to
determine the *lvmid* provided the JVM processes is not running in a
separate docker instance. You can also determine the *lvmid* on Linux and
macOS platforms with the `ps` command, and on Windows with the Windows Task
Manager.
*hostname*
: A host name or IP address that indicates the target host. If the *hostname*
value is omitted, then the target host is the local host.
*port*
: The default port for communicating with the remote server. If the
*hostname* value is omitted or the *protocol* value specifies an optimized,
local protocol, then the *port* value is ignored. Otherwise, treatment of
the *port* parameter is implementation-specific. For the default `rmi`
protocol, the port value indicates the port number for the `rmiregistry` on
the remote host. If the *port* value is omitted and the *protocol* value
indicates `rmi`, then the default rmiregistry port (1099) is used.
*servername*
: The treatment of the *servername* parameter depends on implementation. For
the optimized local protocol, this field is ignored. For the `rmi`
protocol, it represents the name of the RMI remote object on the remote
host.
## Examples
This section presents some examples of monitoring a local JVM with an *lvmid*
of 21891.
## The gcutil Option
This example attaches to lvmid 21891 and takes 7 samples at 250 millisecond
intervals and displays the output as specified by the `-gcutil` option.
The output of this example shows that a young generation collection occurred
between the third and fourth sample. The collection took 0.078 seconds and
promoted objects from the eden space (E) to the old space (O), resulting in an
increase of old space utilization from 66.80% to 68.19%. Before the collection,
the survivor space was 97.02% utilized, but after this collection it's 91.03%
utilized.
```
jstat -gcutil 21891 250 7
S0 S1 E O M CCS YGC YGCT FGC FGCT GCT
0.00 97.02 70.31 66.80 95.52 89.14 7 0.300 0 0.000 0.300
0.00 97.02 86.23 66.80 95.52 89.14 7 0.300 0 0.000 0.300
0.00 97.02 96.53 66.80 95.52 89.14 7 0.300 0 0.000 0.300
91.03 0.00 1.98 68.19 95.89 91.24 8 0.378 0 0.000 0.378
91.03 0.00 15.82 68.19 95.89 91.24 8 0.378 0 0.000 0.378
91.03 0.00 17.80 68.19 95.89 91.24 8 0.378 0 0.000 0.378
91.03 0.00 17.80 68.19 95.89 91.24 8 0.378 0 0.000 0.378
```
## Repeat the Column Header String
This example attaches to lvmid 21891 and takes samples at 250 millisecond
intervals and displays the output as specified by `-gcnew` option. In addition,
it uses the `-h3` option to output the column header after every 3 lines of
data.
In addition to showing the repeating header string, this example shows that
between the second and third samples, a young GC occurred. Its duration was
0.001 seconds. The collection found enough active data that the survivor space
0 utilization (S0U) would have exceeded the desired survivor size (DSS). As a
result, objects were promoted to the old generation (not visible in this
output), and the tenuring threshold (TT) was lowered from 31 to 2.
Another collection occurs between the fifth and sixth samples. This collection
found very few survivors and returned the tenuring threshold to 31.
```
jstat -gcnew -h3 21891 250
S0C S1C S0U S1U TT MTT DSS EC EU YGC YGCT
64.0 64.0 0.0 31.7 31 31 32.0 512.0 178.6 249 0.203
64.0 64.0 0.0 31.7 31 31 32.0 512.0 355.5 249 0.203
64.0 64.0 35.4 0.0 2 31 32.0 512.0 21.9 250 0.204
S0C S1C S0U S1U TT MTT DSS EC EU YGC YGCT
64.0 64.0 35.4 0.0 2 31 32.0 512.0 245.9 250 0.204
64.0 64.0 35.4 0.0 2 31 32.0 512.0 421.1 250 0.204
64.0 64.0 0.0 19.0 31 31 32.0 512.0 84.4 251 0.204
S0C S1C S0U S1U TT MTT DSS EC EU YGC YGCT
64.0 64.0 0.0 19.0 31 31 32.0 512.0 306.7 251 0.204
```
## Include a Time Stamp for Each Sample
This example attaches to lvmid 21891 and takes 3 samples at 250 millisecond
intervals. The `-t` option is used to generate a time stamp for each sample in
the first column.
The Timestamp column reports the elapsed time in seconds since the start of the
target JVM. In addition, the `-gcoldcapacity` output shows the old generation
capacity (OGC) and the old space capacity (OC) increasing as the heap expands
to meet allocation or promotion demands. The old generation capacity (OGC) has
grown from 11,696 KB to 13,820 KB after the eighty-first full garbage
collection (FGC). The maximum capacity of the generation (and space) is 60,544
KB (OGCMX), so it still has room to expand.
```
Timestamp OGCMN OGCMX OGC OC YGC FGC FGCT GCT
150.1 1408.0 60544.0 11696.0 11696.0 194 80 2.874 3.799
150.4 1408.0 60544.0 13820.0 13820.0 194 81 2.938 3.863
150.7 1408.0 60544.0 13820.0 13820.0 194 81 2.938 3.863
```
## Monitor Instrumentation for a Remote JVM
This example attaches to lvmid 40496 on the system named `remote.domain` using
the `-gcutil` option, with samples taken every second indefinitely.
The lvmid is combined with the name of the remote host to construct a vmid of
`40496@remote.domain`. This vmid results in the use of the `rmi` protocol to
communicate to the default `jstatd` server on the remote host. The `jstatd`
server is located using the `rmiregistry` command on `remote.domain` that's
bound to the default port of the `rmiregistry` command (port 1099).
```
jstat -gcutil 40496@remote.domain 1000
... output omitted
```

View File

@ -1,104 +0,0 @@
.\" Copyright (c) 2004, 2018, 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.19.2
.\"
.\" Define V font for inline verbatim, using C font in formats
.\" that render this, and otherwise B font.
.ie "\f[CB]x\f[R]"x" \{\
. ftr V B
. ftr VI BI
. ftr VB B
. ftr VBI BI
.\}
.el \{\
. ftr V CR
. ftr VI CI
. ftr VB CB
. ftr VBI CBI
.\}
.TH "JCONSOLE" "1" "2025" "JDK 24-ea" "JDK Commands"
.hy
.SH NAME
.PP
jconsole - start a graphical console to monitor and manage Java
applications
.SH SYNOPSIS
.PP
\f[V]jconsole\f[R] [\f[V]-interval=\f[R]\f[I]n\f[R]] [\f[V]-notile\f[R]]
[\f[V]-plugin\f[R] \f[I]path\f[R]] [\f[V]-version\f[R]]
[\f[I]connection\f[R] ...
] [\f[V]-J\f[R]\f[I]input_arguments\f[R]]
.PP
\f[V]jconsole\f[R] \f[V]-help\f[R]
.SH OPTIONS
.TP
\f[V]-interval\f[R]
Sets the update interval to \f[V]n\f[R] seconds (default is 4 seconds).
.TP
\f[V]-notile\f[R]
Doesn\[aq]t tile the windows for two or more connections.
.TP
\f[V]-pluginpath\f[R] \f[I]path\f[R]
Specifies the path that \f[V]jconsole\f[R] uses to look up plug-ins.
The plug-in \f[I]path\f[R] should contain a provider-configuration file
named \f[V]META-INF/services/com.sun.tools.jconsole.JConsolePlugin\f[R]
that contains one line for each plug-in.
The line specifies the fully qualified class name of the class
implementing the \f[V]com.sun.tools.jconsole.JConsolePlugin\f[R] class.
.TP
\f[V]-version\f[R]
Prints the program version.
.TP
\f[I]connection\f[R] = \f[I]pid\f[R] | \f[I]host\f[R]\f[V]:\f[R]\f[I]port\f[R] | \f[I]jmxURL\f[R]
A connection is described by either \f[I]pid\f[R],
\f[I]host\f[R]\f[V]:\f[R]\f[I]port\f[R] or \f[I]jmxURL\f[R].
.RS
.IP \[bu] 2
The \f[I]pid\f[R] value is the process ID of a target process.
The JVM must be running with the same user ID as the user ID running the
\f[V]jconsole\f[R] command.
.IP \[bu] 2
The \f[I]host\f[R]\f[V]:\f[R]\f[I]port\f[R] values are the name of the
host system on which the JVM is running, and the port number specified
by the system property \f[V]com.sun.management.jmxremote.port\f[R] when
the JVM was started.
.IP \[bu] 2
The \f[I]jmxUrl\f[R] value is the address of the JMX agent to be
connected to as described in JMXServiceURL.
.RE
.TP
\f[V]-J\f[R]\f[I]input_arguments\f[R]
Passes \f[I]input_arguments\f[R] to the JVM on which the
\f[V]jconsole\f[R] command is run.
.TP
\f[V]-help\f[R] or \f[V]--help\f[R]
Displays the help message for the command.
.SH DESCRIPTION
.PP
The \f[V]jconsole\f[R] command starts a graphical console tool that lets
you monitor and manage Java applications and virtual machines on a local
or remote machine.
.PP
On Windows, the \f[V]jconsole\f[R] command doesn\[aq]t associate with a
console window.
It does, however, display a dialog box with error information when the
\f[V]jconsole\f[R] command fails.

View File

@ -0,0 +1,86 @@
---
# Copyright (c) 2004, 2018, 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.
#
title: 'JCONSOLE(1) JDK @@VERSION_SHORT@@ | JDK Commands'
date: @@COPYRIGHT_YEAR@@
lang: en
---
## Name
jconsole - start a graphical console to monitor and manage Java applications
## Synopsis
`jconsole` \[`-interval=`*n*\] \[`-notile`\] \[`-plugin` *path*\]
\[`-version`\] \[*connection* ... \] \[`-J`*input\_arguments*\]
`jconsole` `-help`
## Options
`-interval`
: Sets the update interval to `n` seconds (default is 4 seconds).
`-notile`
: Doesn't tile the windows for two or more connections.
`-pluginpath` *path*
: Specifies the path that `jconsole` uses to look up plug-ins. The plug-in
*path* should contain a provider-configuration file named
`META-INF/services/com.sun.tools.jconsole.JConsolePlugin` that contains one
line for each plug-in. The line specifies the fully qualified class name of
the class implementing the `com.sun.tools.jconsole.JConsolePlugin` class.
`-version`
: Prints the program version.
*connection* = *pid* \| *host*`:`*port* \| *jmxURL*
: A connection is described by either *pid*, *host*`:`*port* or *jmxURL*.
- The *pid* value is the process ID of a target process. The JVM must be
running with the same user ID as the user ID running the `jconsole`
command.
- The *host*`:`*port* values are the name of the host system on which the
JVM is running, and the port number specified by the system property
`com.sun.management.jmxremote.port` when the JVM was started.
- The *jmxUrl* value is the address of the JMX agent to be connected to
as described in JMXServiceURL.
`-J`*input\_arguments*
: Passes *input\_arguments* to the JVM on which the `jconsole` command is
run.
`-help` or `--help`
: Displays the help message for the command.
## Description
The `jconsole` command starts a graphical console tool that lets you monitor
and manage Java applications and virtual machines on a local or remote machine.
On Windows, the `jconsole` command doesn't associate with a console window. It
does, however, display a dialog box with error information when the `jconsole`
command fails.

View File

@ -1,259 +0,0 @@
.\" Copyright (c) 1994, 2020, 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.19.2
.\"
.\" Define V font for inline verbatim, using C font in formats
.\" that render this, and otherwise B font.
.ie "\f[CB]x\f[R]"x" \{\
. ftr V B
. ftr VI BI
. ftr VB B
. ftr VBI BI
.\}
.el \{\
. ftr V CR
. ftr VI CI
. ftr VB CB
. ftr VBI CBI
.\}
.TH "JAVAP" "1" "2025" "JDK 24-ea" "JDK Commands"
.hy
.SH NAME
.PP
javap - disassemble one or more class files
.SH SYNOPSIS
.PP
\f[V]javap\f[R] [\f[I]options\f[R]] \f[I]classes\f[R]...
.TP
\f[I]options\f[R]
Specifies the command-line options.
See \f[B]Options for javap\f[R].
.TP
\f[I]classes\f[R]
Specifies one or more classes separated by spaces to be processed for
annotations.
You can specify a class that can be found in the class path by its file
name, URL, or by its fully qualified class name.
.RS
.PP
Examples:
.RS
.PP
\f[V]path/to/MyClass.class\f[R]
.RE
.RS
.PP
\f[V]jar:file:///path/to/MyJar.jar!/mypkg/MyClass.class\f[R]
.RE
.RS
.PP
\f[V]java.lang.Object\f[R]
.RE
.RE
.SH DESCRIPTION
.PP
The \f[V]javap\f[R] command disassembles one or more class files.
The output depends on the options used.
When no options are used, the \f[V]javap\f[R] command prints the
protected and public fields, and methods of the classes passed to it.
.PP
The \f[V]javap\f[R] command isn\[aq]t multirelease JAR aware.
Using the class path form of the command results in viewing the base
entry in all JAR files, multirelease or not.
Using the URL form, you can use the URL form of an argument to specify a
specific version of a class to be disassembled.
.PP
The \f[V]javap\f[R] command prints its output to \f[V]stdout\f[R].
.PP
\f[B]Note:\f[R]
.PP
In tools that support \f[V]--\f[R] style options, the GNU-style options
can use the equal sign (\f[V]=\f[R]) instead of a white space to
separate the name of an option from its value.
.SH OPTIONS FOR JAVAP
.TP
\f[V]--help\f[R], \f[V]-help\f[R] , \f[V]-h\f[R], or \f[V]-?\f[R]
Prints a help message for the \f[V]javap\f[R] command.
.TP
\f[V]-version\f[R]
Prints release information.
.TP
\f[V]-verbose\f[R] or \f[V]-v\f[R]
Prints additional information about the selected class.
.TP
\f[V]-l\f[R]
Prints line and local variable tables.
.TP
\f[V]-public\f[R]
Shows only public classes and members.
.TP
\f[V]-protected\f[R]
Shows only protected and public classes and members.
.TP
\f[V]-package\f[R]
Shows package/protected/public classes and members (default).
.TP
\f[V]-private\f[R] or \f[V]-p\f[R]
Shows all classes and members.
.TP
\f[V]-c\f[R]
Prints disassembled code, for example, the instructions that comprise
the Java bytecodes, for each of the methods in the class.
.TP
\f[V]-s\f[R]
Prints internal type signatures.
.TP
\f[V]-sysinfo\f[R]
Shows system information (path, size, date, SHA-256 hash) of the class
being processed.
.TP
\f[V]-verify\f[R]
Prints additional class verification info.
.TP
\f[V]-constants\f[R]
Shows \f[V]static final\f[R] constants.
.TP
\f[V]--module\f[R] \f[I]module\f[R] or \f[V]-m\f[R] \f[I]module\f[R]
Specifies the module containing classes to be disassembled.
.TP
\f[V]--module-path\f[R] \f[I]path\f[R]
Specifies where to find application modules.
.TP
\f[V]--system\f[R] \f[I]jdk\f[R]
Specifies where to find system modules.
.TP
\f[V]--class-path\f[R] \f[I]path\f[R], \f[V]-classpath\f[R] \f[I]path\f[R], or \f[V]-cp\f[R] \f[I]path\f[R]
Specifies the path that the \f[V]javap\f[R] command uses to find user
class files.
It overrides the default or the \f[V]CLASSPATH\f[R] environment variable
when it\[aq]s set.
.TP
\f[V]-bootclasspath\f[R] \f[I]path\f[R]
Overrides the location of bootstrap class files.
.TP
\f[V]--multi-release\f[R] \f[I]version\f[R]
Specifies the version to select in multi-release JAR files.
.TP
\f[V]-J\f[R]\f[I]option\f[R]
Passes the specified option to the JVM.
For example:
.RS
.IP
.nf
\f[CB]
javap -J-version
javap -J-Djava.security.manager -J-Djava.security.policy=MyPolicy MyClassName
\f[R]
.fi
.PP
See \f[I]Overview of Java Options\f[R] in \f[B]java\f[R].
.RE
.SH JAVAP EXAMPLE
.PP
Compile the following \f[V]HelloWorldFrame\f[R] class:
.IP
.nf
\f[CB]
import java.awt.Graphics;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class HelloWorldFrame extends JFrame {
String message = \[dq]Hello World!\[dq];
public HelloWorldFrame(){
setContentPane(new JPanel(){
\[at]Override
protected void paintComponent(Graphics g) {
g.drawString(message, 15, 30);
}
});
setSize(100, 100);
}
public static void main(String[] args) {
HelloWorldFrame frame = new HelloWorldFrame();
frame.setVisible(true);
}
}
\f[R]
.fi
.PP
The output from the \f[V]javap HelloWorldFrame.class\f[R] command yields
the following:
.IP
.nf
\f[CB]
Compiled from \[dq]HelloWorldFrame.java\[dq]
public class HelloWorldFrame extends javax.swing.JFrame {
java.lang.String message;
public HelloWorldFrame();
public static void main(java.lang.String[]);
}
\f[R]
.fi
.PP
The output from the \f[V]javap -c HelloWorldFrame.class\f[R] command
yields the following:
.IP
.nf
\f[CB]
Compiled from \[dq]HelloWorldFrame.java\[dq]
public class HelloWorldFrame extends javax.swing.JFrame {
java.lang.String message;
public HelloWorldFrame();
Code:
0: aload_0
1: invokespecial #1 // Method javax/swing/JFrame.\[dq]<init>\[dq]:()V
4: aload_0
5: ldc #2 // String Hello World!
7: putfield #3 // Field message:Ljava/lang/String;
10: aload_0
11: new #4 // class HelloWorldFrame$1
14: dup
15: aload_0
16: invokespecial #5 // Method HelloWorldFrame$1.\[dq]<init>\[dq]:(LHelloWorldFrame;)V
19: invokevirtual #6 // Method setContentPane:(Ljava/awt/Container;)V
22: aload_0
23: bipush 100
25: bipush 100
27: invokevirtual #7 // Method setSize:(II)V
30: return
public static void main(java.lang.String[]);
Code:
0: new #8 // class HelloWorldFrame
3: dup
4: invokespecial #9 // Method \[dq]<init>\[dq]:()V
7: astore_1
8: aload_1
9: iconst_1
10: invokevirtual #10 // Method setVisible:(Z)V
13: return
}
\f[R]
.fi

View File

@ -0,0 +1,227 @@
---
# Copyright (c) 1994, 2020, 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.
#
title: 'JAVAP(1) JDK @@VERSION_SHORT@@ | JDK Commands'
date: @@COPYRIGHT_YEAR@@
lang: en
---
## Name
javap - disassemble one or more class files
## Synopsis
`javap` \[*options*\] *classes*...
*options*
: Specifies the command-line options. See [Options for javap].
*classes*
: Specifies one or more classes separated by spaces to be processed for
annotations. You can specify a class that can be found in the class path by
its file name, URL, or by its fully qualified class name.
Examples:
> `path/to/MyClass.class`
> `jar:file:///path/to/MyJar.jar!/mypkg/MyClass.class`
> `java.lang.Object`
## Description
The `javap` command disassembles one or more class files. The output depends on
the options used. When no options are used, the `javap` command prints the
protected and public fields, and methods of the classes passed to it.
The `javap` command isn't multirelease JAR aware. Using the class path form of
the command results in viewing the base entry in all JAR files, multirelease or
not. Using the URL form, you can use the URL form of an argument to specify a
specific version of a class to be disassembled.
The `javap` command prints its output to `stdout`.
**Note:**
In tools that support `--` style options, the GNU-style options can use the
equal sign (`=`) instead of a white space to separate the name of an option
from its value.
## Options for javap
`--help`, `-help` , `-h`, or `-?`
: Prints a help message for the `javap` command.
`-version`
: Prints release information.
`-verbose` or `-v`
: Prints additional information about the selected class.
`-l`
: Prints line and local variable tables.
`-public`
: Shows only public classes and members.
`-protected`
: Shows only protected and public classes and members.
`-package`
: Shows package/protected/public classes and members (default).
`-private` or `-p`
: Shows all classes and members.
`-c`
: Prints disassembled code, for example, the instructions that comprise the
Java bytecodes, for each of the methods in the class.
`-s`
: Prints internal type signatures.
`-sysinfo`
: Shows system information (path, size, date, SHA-256 hash) of the class being
processed.
`-verify`
: Prints additional class verification info.
`-constants`
: Shows `static final` constants.
`--module` *module* or `-m` *module*
: Specifies the module containing classes to be disassembled.
`--module-path` *path*
: Specifies where to find application modules.
`--system` *jdk*
: Specifies where to find system modules.
`--class-path` *path*, `-classpath` *path*, or `-cp` *path*
: Specifies the path that the `javap` command uses to find user class files.
It overrides the default or the `CLASSPATH` environment variable when it's
set.
`-bootclasspath` *path*
: Overrides the location of bootstrap class files.
`--multi-release` *version*
: Specifies the version to select in multi-release JAR files.
`-J`*option*
: Passes the specified option to the JVM. For example:
```
javap -J-version
javap -J-Djava.security.manager -J-Djava.security.policy=MyPolicy MyClassName
```
See *Overview of Java Options* in [java](java.html).
## javap Example
Compile the following `HelloWorldFrame` class:
```
import java.awt.Graphics;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class HelloWorldFrame extends JFrame {
String message = "Hello World!";
public HelloWorldFrame(){
setContentPane(new JPanel(){
@Override
protected void paintComponent(Graphics g) {
g.drawString(message, 15, 30);
}
});
setSize(100, 100);
}
public static void main(String[] args) {
HelloWorldFrame frame = new HelloWorldFrame();
frame.setVisible(true);
}
}
```
The output from the `javap HelloWorldFrame.class` command yields the following:
```
Compiled from "HelloWorldFrame.java"
public class HelloWorldFrame extends javax.swing.JFrame {
java.lang.String message;
public HelloWorldFrame();
public static void main(java.lang.String[]);
}
```
The output from the `javap -c HelloWorldFrame.class` command yields the
following:
```
Compiled from "HelloWorldFrame.java"
public class HelloWorldFrame extends javax.swing.JFrame {
java.lang.String message;
public HelloWorldFrame();
Code:
0: aload_0
1: invokespecial #1 // Method javax/swing/JFrame."<init>":()V
4: aload_0
5: ldc #2 // String Hello World!
7: putfield #3 // Field message:Ljava/lang/String;
10: aload_0
11: new #4 // class HelloWorldFrame$1
14: dup
15: aload_0
16: invokespecial #5 // Method HelloWorldFrame$1."<init>":(LHelloWorldFrame;)V
19: invokevirtual #6 // Method setContentPane:(Ljava/awt/Container;)V
22: aload_0
23: bipush 100
25: bipush 100
27: invokevirtual #7 // Method setSize:(II)V
30: return
public static void main(java.lang.String[]);
Code:
0: new #8 // class HelloWorldFrame
3: dup
4: invokespecial #9 // Method "<init>":()V
7: astore_1
8: aload_1
9: iconst_1
10: invokevirtual #10 // Method setVisible:(Z)V
13: return
}
```

View File

@ -1,271 +0,0 @@
.\" Copyright (c) 2017, 2023, 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.19.2
.\"
.\" Define V font for inline verbatim, using C font in formats
.\" that render this, and otherwise B font.
.ie "\f[CB]x\f[R]"x" \{\
. ftr V B
. ftr VI BI
. ftr VB B
. ftr VBI BI
.\}
.el \{\
. ftr V CR
. ftr VI CI
. ftr VB CB
. ftr VBI CBI
.\}
.TH "JDEPRSCAN" "1" "2025" "JDK 24-ea" "JDK Commands"
.hy
.SH NAME
.PP
jdeprscan - static analysis tool that scans a jar file (or some other
aggregation of class files) for uses of deprecated API elements
.SH SYNOPSIS
.PP
\f[V]jdeprscan\f[R] [\f[I]options\f[R]]
{\f[I]dir\f[R]|\f[I]jar\f[R]|\f[I]class\f[R]}
.TP
\f[I]options\f[R]
See \f[B]Options for the jdeprscan Command\f[R]
.TP
\f[I]dir\f[R]|\f[I]jar\f[R]|\f[I]class\f[R]
\f[V]jdeprscan\f[R] command scans each argument for usages of deprecated
APIs.
The arguments can be a:
.RS
.IP \[bu] 2
\f[I]dir\f[R]: Directory
.IP \[bu] 2
\f[I]jar\f[R]: JAR file
.IP \[bu] 2
\f[I]class\f[R]: Class name or class file
.PP
The class name should use a dot (\f[V].\f[R]) as a separator.
For example:
.PP
\f[V]java.lang.Thread\f[R]
.PP
For nested classes, the dollar sign \f[V]$\f[R] separator character
should be used.
For example:
.PP
\f[V]java.lang.Thread$State\f[R]
.PP
A class file can also be named.
For example:
.PP
\f[V]build/classes/java/lang/Thread$State.class\f[R]
.RE
.SH DESCRIPTION
.PP
The \f[V]jdeprscan\f[R] tool is a static analysis tool provided by the
JDK that scans a JAR file or some other aggregation of class files for
uses of deprecated API elements.
The deprecated APIs identified by the \f[V]jdeprscan\f[R] tool are only
those that are defined by Java SE.
Deprecated APIs defined by third-party libraries aren\[aq]t reported.
.PP
To scan a JAR file or a set of class files, you must first ensure that
all of the classes that the scanned classes depend upon are present in
the class path.
Set the class path using the \f[V]--class-path\f[R] option described in
\f[B]Options for the jdeprscan Command\f[R].
Typically, you would use the same class path as the one that you use
when invoking your application.
.PP
If the \f[V]jdeprscan\f[R] can\[aq]t find all the dependent classes, it
will generate an error message for each class that\[aq]s missing.
These error messages are typically of the form:
.RS
.PP
\f[V]error: cannot find class ...\f[R]
.RE
.PP
If these errors occur, then you must adjust the class path so that it
includes all dependent classes.
.SH OPTIONS FOR THE JDEPRSCAN COMMAND
.PP
The following options are available:
.TP
\f[V]--class-path\f[R] \f[I]path\f[R]
Provides a search path for resolution of dependent classes.
.RS
.PP
\f[I]path\f[R] can be a search path that consists of one or more
directories separated by the system-specific path separator.
For example:
.IP \[bu] 2
\f[B]Linux and macOS:\f[R]
.RS 2
.RS
.PP
\f[V]--class-path /some/directory:/another/different/dir\f[R]
.RE
.RE
.PP
\f[B]Note:\f[R]
.PP
On Windows, use a semicolon (\f[V];\f[R]) as the separator instead of a
colon (\f[V]:\f[R]).
.IP \[bu] 2
\f[B]Windows:\f[R]
.RS 2
.RS
.PP
\f[V]--class-path \[rs]some\[rs]directory;\[rs]another\[rs]different\[rs]dir\f[R]
.RE
.RE
.RE
.TP
\f[V]--for-removal\f[R]
Limits scanning or listing to APIs that are deprecated for removal.
Can\[aq]t be used with a release value of 6, 7, or 8.
.TP
\f[V]--full-version\f[R]
Prints out the full version string of the tool.
.TP
\f[V]--help\f[R] or \f[V]-h\f[R]
Prints out a full help message.
.TP
\f[V]--list\f[R] or \f[V]-l\f[R]
Prints the set of deprecated APIs.
No scanning is done, so no directory, jar, or class arguments should be
provided.
.TP
\f[V]--release\f[R] \f[V]6\f[R]|\f[V]7\f[R]|\f[V]8\f[R]|\f[V]9\f[R]
Specifies the Java SE release that provides the set of deprecated APIs
for scanning.
.TP
\f[V]--verbose\f[R] or \f[V]-v\f[R]
Enables additional message output during processing.
.TP
\f[V]--version\f[R]
Prints out the abbreviated version string of the tool.
.SH EXAMPLE OF JDEPRSCAN OUTPUT
.PP
The JAR file for this library will be named something similar to
\f[V]commons-math3-3.6.1.jar\f[R].
To scan this JAR file for the use of deprecated APIs, run the following
command:
.RS
.PP
\f[V]jdeprscan commons-math3-3.6.1.jar\f[R]
.RE
.PP
This command produces several lines of output.
For example, one line of output might be:
.IP
.nf
\f[CB]
class org/apache/commons/math3/util/MathUtils uses deprecated method java/lang/Double::<init>(D)V
\f[R]
.fi
.PP
\f[B]Note:\f[R]
.PP
The class name is specified using the slash-separated binary name as
described in JVMS 4.2.1.
This is the form used internally in class files.
.PP
The deprecated API it uses is a method on the \f[V]java.lang.Double\f[R]
class.
.PP
The name of the deprecated method is \f[V]<init>\f[R], which is a
special name that means that the method is actually a constructor.
Another special name is \f[V]<clinit>\f[R], which indicates a class
static initializer.
.PP
Other methods are listed just by their method name.
Following the method name is the argument list and return type:
.RS
.PP
\f[V](D)V\f[R]
.RE
.PP
This indicates that it takes just one double value (a primitive) and
returns void.
The argument and return types can become cryptic.
For example, another line of output might be:
.IP
.nf
\f[CB]
class org/apache/commons/math3/util/Precision uses deprecated method java/math/BigDecimal::setScale(II)Ljava/math/BigDecimal;
\f[R]
.fi
.PP
In this line of output, the deprecated method is on class
\f[V]java.math.BigDecimal\f[R], and the method is \f[V]setScale()\f[R].
In this case, the \f[V](II)\f[R] means that it takes two \f[V]int\f[R]
arguments.
The \f[V]Ljava/math/BigDecimal;\f[R] after the parentheses means that it
returns a reference to \f[V]java.math.BigDecimal\f[R].
.SH JDEPRSCAN ANALYSIS CAN BE VERSION-SPECIFIC
.PP
You can use \f[V]jdeprscan\f[R] relative to the previous three JDK
releases.
For example, if you are running JDK 9, then you can check against JDK 8,
7, and 6.
.PP
As an example, look at this code snippet:
.IP
.nf
\f[CB]
public class Deprecations {
SecurityManager sm = new RMISecurityManager(); // deprecated in 8
Boolean b2 = new Boolean(true); // deprecated in 9
}
\f[R]
.fi
.PP
The complete class compiles without warnings in JDK 7.
.PP
If you run \f[V]jdeprscan\f[R] on a system with JDK 9, then you see:
.IP
.nf
\f[CB]
$ jdeprscan --class-path classes --release 7 example.Deprecations
(no output)
\f[R]
.fi
.PP
Run \f[V]jdeprscan\f[R] with a release value of 8:
.IP
.nf
\f[CB]
$ jdeprscan --class-path classes --release 8 example.Deprecations
class example/Deprecations uses type java/rmi/RMISecurityManager deprecated
class example/Deprecations uses method in type java/rmi/RMISecurityManager deprecated
\f[R]
.fi
.PP
Run \f[V]jdeprscan\f[R] on JDK 9:
.IP
.nf
\f[CB]
$ jdeprscan --class-path classes example.Deprecations
class example/Deprecations uses type java/rmi/RMISecurityManager deprecated
class example/Deprecations uses method in type java/rmi/RMISecurityManager deprecated
class example/Deprecations uses method java/lang/Boolean <init> (Z)V deprecated
\f[R]
.fi

View File

@ -0,0 +1,217 @@
---
# Copyright (c) 2017, 2023, 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.
#
title: 'JDEPRSCAN(1) JDK @@VERSION_SHORT@@ | JDK Commands'
date: @@COPYRIGHT_YEAR@@
lang: en
---
## Name
jdeprscan - static analysis tool that scans a jar file (or some other
aggregation of class files) for uses of deprecated API elements
## Synopsis
`jdeprscan` \[*options*\] {*dir*\|*jar*\|*class*}
*options*
: See [Options for the jdeprscan Command]
*dir*\|*jar*\|*class*
: `jdeprscan` command scans each argument for usages of deprecated APIs. The
arguments can be a:
- *dir*: Directory
- *jar*: JAR file
- *class*: Class name or class file
The class name should use a dot (`.`) as a separator. For example:
`java.lang.Thread`
For nested classes, the dollar sign `$` separator character should be used.
For example:
`java.lang.Thread$State`
A class file can also be named. For example:
`build/classes/java/lang/Thread$State.class`
## Description
The `jdeprscan` tool is a static analysis tool provided by the JDK that scans a
JAR file or some other aggregation of class files for uses of deprecated API
elements. The deprecated APIs identified by the `jdeprscan` tool are only those
that are defined by Java SE. Deprecated APIs defined by third-party libraries
aren't reported.
To scan a JAR file or a set of class files, you must first ensure that all of
the classes that the scanned classes depend upon are present in the class
path. Set the class path using the `--class-path` option described in [Options
for the jdeprscan Command]. Typically, you would use the same class path as
the one that you use when invoking your application.
If the `jdeprscan` can't find all the dependent classes, it will generate an
error message for each class that's missing. These error messages are typically
of the form:
> `error: cannot find class ...`
If these errors occur, then you must adjust the class path so that it includes
all dependent classes.
## Options for the jdeprscan Command
The following options are available:
`--class-path` *path*
: Provides a search path for resolution of dependent classes.
*path* can be a search path that consists of one or more directories
separated by the system-specific path separator. For example:
- **Linux and macOS:**
> `--class-path /some/directory:/another/different/dir`
**Note:**
On Windows, use a semicolon (`;`) as the separator instead of a colon
(`:`).
- **Windows:**
> `--class-path \some\directory;\another\different\dir`
`--for-removal`
: Limits scanning or listing to APIs that are deprecated for removal. Can't
be used with a release value of 6, 7, or 8.
`--full-version`
: Prints out the full version string of the tool.
`--help` or `-h`
: Prints out a full help message.
`--list` or `-l`
: Prints the set of deprecated APIs. No scanning is done, so no directory,
jar, or class arguments should be provided.
`--release` `6`\|`7`\|`8`\|`9`
: Specifies the Java SE release that provides the set of deprecated APIs for
scanning.
`--verbose` or `-v`
: Enables additional message output during processing.
`--version`
: Prints out the abbreviated version string of the tool.
## Example of jdeprscan Output
The JAR file for this library will be named something similar to
`commons-math3-3.6.1.jar`. To scan this JAR file for the use of deprecated
APIs, run the following command:
> `jdeprscan commons-math3-3.6.1.jar`
This command produces several lines of output. For example, one line of output
might be:
```
class org/apache/commons/math3/util/MathUtils uses deprecated method java/lang/Double::<init>(D)V
```
**Note:**
The class name is specified using the slash-separated binary name as described
in JVMS 4.2.1. This is the form used internally in class files.
The deprecated API it uses is a method on the `java.lang.Double` class.
The name of the deprecated method is `<init>`, which is a special name that
means that the method is actually a constructor. Another special name is
`<clinit>`, which indicates a class static initializer.
Other methods are listed just by their method name. Following the method name
is the argument list and return type:
> `(D)V`
This indicates that it takes just one double value (a primitive) and returns
void. The argument and return types can become cryptic. For example, another
line of output might be:
```
class org/apache/commons/math3/util/Precision uses deprecated method java/math/BigDecimal::setScale(II)Ljava/math/BigDecimal;
```
In this line of output, the deprecated method is on class
`java.math.BigDecimal`, and the method is `setScale()`. In this case, the
`(II)` means that it takes two `int` arguments. The `Ljava/math/BigDecimal;`
after the parentheses means that it returns a reference to
`java.math.BigDecimal`.
## jdeprscan Analysis Can Be Version-Specific
You can use `jdeprscan` relative to the previous three JDK releases. For
example, if you are running JDK 9, then you can check against JDK 8, 7, and 6.
As an example, look at this code snippet:
```
public class Deprecations {
SecurityManager sm = new RMISecurityManager(); // deprecated in 8
Boolean b2 = new Boolean(true); // deprecated in 9
}
```
The complete class compiles without warnings in JDK 7.
If you run `jdeprscan` on a system with JDK 9, then you see:
```
$ jdeprscan --class-path classes --release 7 example.Deprecations
(no output)
```
Run `jdeprscan` with a release value of 8:
```
$ jdeprscan --class-path classes --release 8 example.Deprecations
class example/Deprecations uses type java/rmi/RMISecurityManager deprecated
class example/Deprecations uses method in type java/rmi/RMISecurityManager deprecated
```
Run `jdeprscan` on JDK 9:
```
$ jdeprscan --class-path classes example.Deprecations
class example/Deprecations uses type java/rmi/RMISecurityManager deprecated
class example/Deprecations uses method in type java/rmi/RMISecurityManager deprecated
class example/Deprecations uses method java/lang/Boolean <init> (Z)V deprecated
```

View File

@ -1,338 +0,0 @@
.\" Copyright (c) 2013, 2023, 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.19.2
.\"
.\" Define V font for inline verbatim, using C font in formats
.\" that render this, and otherwise B font.
.ie "\f[CB]x\f[R]"x" \{\
. ftr V B
. ftr VI BI
. ftr VB B
. ftr VBI BI
.\}
.el \{\
. ftr V CR
. ftr VI CI
. ftr VB CB
. ftr VBI CBI
.\}
.TH "JDEPS" "1" "2025" "JDK 24-ea" "JDK Commands"
.hy
.SH NAME
.PP
jdeps - launch the Java class dependency analyzer
.SH SYNOPSIS
.PP
\f[V]jdeps\f[R] [\f[I]options\f[R]] \f[I]path\f[R] ...
.TP
\f[I]options\f[R]
Command-line options.
For detailed descriptions of the options that can be used, see
.RS
.IP \[bu] 2
\f[B]Possible Options\f[R]
.IP \[bu] 2
\f[B]Module Dependence Analysis Options\f[R]
.IP \[bu] 2
\f[B]Options to Filter Dependences\f[R]
.IP \[bu] 2
\f[B]Options to Filter Classes to be Analyzed\f[R]
.RE
.TP
\f[I]path\f[R]
A pathname to the \f[V].class\f[R] file, directory, or JAR file to
analyze.
.SH DESCRIPTION
.PP
The \f[V]jdeps\f[R] command shows the package-level or class-level
dependencies of Java class files.
The input class can be a path name to a \f[V].class\f[R] file, a
directory, a JAR file, or it can be a fully qualified class name to
analyze all class files.
The options determine the output.
By default, the \f[V]jdeps\f[R] command writes the dependencies to the
system output.
The command can generate the dependencies in DOT language (see the
\f[V]-dotoutput\f[R] option).
.SH POSSIBLE OPTIONS
.TP
\f[V]-?\f[R] or \f[V]-h\f[R] or \f[V]--help\f[R]
Prints the help message.
.TP
\f[V]-dotoutput\f[R] \f[I]dir\f[R] or \f[V]--dot-output\f[R] \f[I]dir\f[R]
Specifies the destination directory for DOT file output.
If this option is specified, then the \f[V]jdeps\f[R]command generates
one \f[V].dot\f[R] file for each analyzed archive named
\f[V]archive-file-name.dot\f[R] that lists the dependencies, and also a
summary file named \f[V]summary.dot\f[R] that lists the dependencies
among the archive files.
.TP
\f[V]-s\f[R] or \f[V]-summary\f[R]
Prints a dependency summary only.
.TP
\f[V]-v\f[R] or \f[V]-verbose\f[R]
Prints all class-level dependencies.
This is equivalent to
.RS
.RS
.PP
\f[V]-verbose:class -filter:none\f[R]
.RE
.RE
.TP
\f[V]-verbose:package\f[R]
Prints package-level dependencies excluding, by default, dependences
within the same package.
.TP
\f[V]-verbose:class\f[R]
Prints class-level dependencies excluding, by default, dependencies
within the same archive.
.TP
\f[V]-apionly\f[R] or \f[V]--api-only\f[R]
Restricts the analysis to APIs, for example, dependences from the
signature of \f[V]public\f[R] and \f[V]protected\f[R] members of public
classes including field type, method parameter types, returned type, and
checked exception types.
.TP
\f[V]-jdkinternals\f[R] or \f[V]--jdk-internals\f[R]
Finds class-level dependences in the JDK internal APIs.
By default, this option analyzes all classes specified in the
\f[V]--classpath\f[R] option and input files unless you specified the
\f[V]-include\f[R] option.
You can\[aq]t use this option with the \f[V]-p\f[R], \f[V]-e\f[R], and
\f[V]-s\f[R] options.
.RS
.PP
\f[B]Warning\f[R]: The JDK internal APIs are inaccessible.
.RE
.TP
\f[V]-cp\f[R] \f[I]path\f[R], \f[V]-classpath\f[R] \f[I]path\f[R], or \f[V]--class-path\f[R] \f[I]path\f[R]
Specifies where to find class files.
.TP
\f[V]--module-path\f[R] \f[I]module-path\f[R]
Specifies the module path.
.TP
\f[V]--upgrade-module-path\f[R] \f[I]module-path\f[R]
Specifies the upgrade module path.
.TP
\f[V]--system\f[R] \f[I]java-home\f[R]
Specifies an alternate system module path.
.TP
\f[V]--add-modules\f[R] \f[I]module-name\f[R][\f[V],\f[R] \f[I]module-name\f[R]...]
Adds modules to the root set for analysis.
.TP
\f[V]--multi-release\f[R] \f[I]version\f[R]
Specifies the version when processing multi-release JAR files.
\f[I]version\f[R] should be an integer >=9 or base.
.TP
\f[V]-q\f[R] or \f[V]-quiet\f[R]
Doesn\[aq]t show missing dependencies from
\f[V]-generate-module-info\f[R] output.
.TP
\f[V]-version\f[R] or \f[V]--version\f[R]
Prints version information.
.SH MODULE DEPENDENCE ANALYSIS OPTIONS
.TP
\f[V]-m\f[R] \f[I]module-name\f[R] or \f[V]--module\f[R] \f[I]module-name\f[R]
Specifies the root module for analysis.
.TP
\f[V]--generate-module-info\f[R] \f[I]dir\f[R]
Generates \f[V]module-info.java\f[R] under the specified directory.
The specified JAR files will be analyzed.
This option cannot be used with \f[V]--dot-output\f[R] or
\f[V]--class-path\f[R] options.
Use the \f[V]--generate-open-module\f[R] option for open modules.
.TP
\f[V]--generate-open-module\f[R] \f[I]dir\f[R]
Generates \f[V]module-info.java\f[R] for the specified JAR files under
the specified directory as open modules.
This option cannot be used with the \f[V]--dot-output\f[R] or
\f[V]--class-path\f[R] options.
.TP
\f[V]--check\f[R] \f[I]module-name\f[R] [\f[V],\f[R] \f[I]module-name\f[R]...]
Analyzes the dependence of the specified modules.
It prints the module descriptor, the resulting module dependences after
analysis and the graph after transition reduction.
It also identifies any unused qualified exports.
.TP
\f[V]--list-deps\f[R]
Lists the module dependences and also the package names of JDK internal
APIs (if referenced).
This option transitively analyzes libraries on class path and module
path if referenced.
Use \f[V]--no-recursive\f[R] option for non-transitive dependency
analysis.
.TP
\f[V]--list-reduced-deps\f[R]
Same as \f[V]--list-deps\f[R] without listing the implied reads edges
from the module graph.
If module M1 reads M2, and M2 requires transitive on M3, then M1 reading
M3 is implied and is not shown in the graph.
.TP
\f[V]--print-module-deps\f[R]
Same as \f[V]--list-reduced-deps\f[R] with printing a comma-separated
list of module dependences.
The output can be used by \f[V]jlink --add-modules\f[R] to create a
custom image that contains those modules and their transitive
dependences.
.TP
\f[V]--ignore-missing-deps\f[R]
Ignore missing dependences.
.SH OPTIONS TO FILTER DEPENDENCES
.TP
\f[V]-p\f[R] \f[I]pkg_name\f[R], \f[V]-package\f[R] \f[I]pkg_name\f[R], or \f[V]--package\f[R] \f[I]pkg_name\f[R]
Finds dependences matching the specified package name.
You can specify this option multiple times for different packages.
The \f[V]-p\f[R] and \f[V]-e\f[R] options are mutually exclusive.
.TP
\f[V]-e\f[R] \f[I]regex\f[R], \f[V]-regex\f[R] \f[I]regex\f[R], or \f[V]--regex\f[R] \f[I]regex\f[R]
Finds dependences matching the specified pattern.
The \f[V]-p\f[R] and \f[V]-e\f[R] options are mutually exclusive.
.TP
\f[V]--require\f[R] \f[I]module-name\f[R]
Finds dependences matching the given module name (may be given multiple
times).
The \f[V]--package\f[R], \f[V]--regex\f[R], and \f[V]--require\f[R]
options are mutually exclusive.
.TP
\f[V]-f\f[R] \f[I]regex\f[R] or \f[V]-filter\f[R] \f[I]regex\f[R]
Filters dependences matching the given pattern.
If give multiple times, the last one will be selected.
.TP
\f[V]-filter:package\f[R]
Filters dependences within the same package.
This is the default.
.TP
\f[V]-filter:archive\f[R]
Filters dependences within the same archive.
.TP
\f[V]-filter:module\f[R]
Filters dependences within the same module.
.TP
\f[V]-filter:none\f[R]
No \f[V]-filter:package\f[R] and \f[V]-filter:archive\f[R] filtering.
Filtering specified via the \f[V]-filter\f[R] option still applies.
.TP
\f[V]--missing-deps\f[R]
Finds missing dependences.
This option cannot be used with \f[V]-p\f[R], \f[V]-e\f[R] and
\f[V]-s\f[R] options.
.SH OPTIONS TO FILTER CLASSES TO BE ANALYZED
.TP
\f[V]-include\f[R] \f[I]regex\f[R]
Restricts analysis to the classes matching pattern.
This option filters the list of classes to be analyzed.
It can be used together with \f[V]-p\f[R] and \f[V]-e\f[R], which apply
the pattern to the dependencies.
.TP
\f[V]-R\f[R] or \f[V]--recursive\f[R]
Recursively traverses all run-time dependences.
The \f[V]-R\f[R] option implies \f[V]-filter:none\f[R].
If \f[V]-p\f[R], \f[V]-e\f[R], or \f[V]-f\f[R] options are specified,
only the matching dependences are analyzed.
.TP
\f[V]--no-recursive\f[R]
Do not recursively traverse dependences.
.TP
\f[V]-I\f[R] or \f[V]--inverse\f[R]
Analyzes the dependences per other given options and then finds all
artifacts that directly and indirectly depend on the matching nodes.
This is equivalent to the inverse of the compile-time view analysis and
the print dependency summary.
This option must be used with the \f[V]--require\f[R],
\f[V]--package\f[R], or \f[V]--regex\f[R] options.
.TP
\f[V]--compile-time\f[R]
Analyzes the compile-time view of transitive dependencies, such as the
compile-time view of the \f[V]-R\f[R] option.
Analyzes the dependences per other specified options.
If a dependency is found from a directory, a JAR file or a module, all
classes in that containing archive are analyzed.
.SH EXAMPLE OF ANALYZING DEPENDENCIES
.PP
The following example demonstrates analyzing the dependencies of the
\f[V]Notepad.jar\f[R] file.
.PP
\f[B]Linux and macOS:\f[R]
.IP
.nf
\f[CB]
$ jdeps demo/jfc/Notepad/Notepad.jar
Notepad.jar -> java.base
Notepad.jar -> java.desktop
Notepad.jar -> java.logging
<unnamed> (Notepad.jar)
-> java.awt
-> java.awt.event
-> java.beans
-> java.io
-> java.lang
-> java.net
-> java.util
-> java.util.logging
-> javax.swing
-> javax.swing.border
-> javax.swing.event
-> javax.swing.text
-> javax.swing.tree
-> javax.swing.undo
\f[R]
.fi
.PP
\f[B]Windows:\f[R]
.IP
.nf
\f[CB]
C:\[rs]Java\[rs]jdk1.9.0>jdeps demo\[rs]jfc\[rs]Notepad\[rs]Notepad.jar
Notepad.jar -> java.base
Notepad.jar -> java.desktop
Notepad.jar -> java.logging
<unnamed> (Notepad.jar)
-> java.awt
-> java.awt.event
-> java.beans
-> java.io
-> java.lang
-> java.net
-> java.util
-> java.util.logging
-> javax.swing
-> javax.swing.border
-> javax.swing.event
-> javax.swing.text
-> javax.swing.tree
-> javax.swing.undo
\f[R]
.fi
.SH EXAMPLE USING THE --INVERSE OPTION
.IP
.nf
\f[CB]
$ jdeps --inverse --require java.xml.bind
Inverse transitive dependences on [java.xml.bind]
java.xml.bind <- java.se.ee
java.xml.bind <- jdk.xml.ws
java.xml.bind <- java.xml.ws <- java.se.ee
java.xml.bind <- java.xml.ws <- jdk.xml.ws
java.xml.bind <- jdk.xml.bind <- jdk.xml.ws
\f[R]
.fi

View File

@ -0,0 +1,297 @@
---
# Copyright (c) 2013, 2023, 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.
#
title: 'JDEPS(1) JDK @@VERSION_SHORT@@ | JDK Commands'
date: @@COPYRIGHT_YEAR@@
lang: en
---
## Name
jdeps - launch the Java class dependency analyzer
## Synopsis
`jdeps` \[*options*\] *path* ...
*options*
: Command-line options. For detailed descriptions of the options that can be
used, see
- [Possible Options]
- [Module Dependence Analysis Options]
- [Options to Filter Dependences]
- [Options to Filter Classes to be Analyzed]
*path*
: A pathname to the `.class` file, directory, or JAR file to analyze.
## Description
The `jdeps` command shows the package-level or class-level dependencies of Java
class files. The input class can be a path name to a `.class` file, a
directory, a JAR file, or it can be a fully qualified class name to analyze all
class files. The options determine the output. By default, the `jdeps` command
writes the dependencies to the system output. The command can generate the
dependencies in DOT language (see the `-dotoutput` option).
## Possible Options
`-?` or `-h` or `--help`
: Prints the help message.
`-dotoutput` *dir* or `--dot-output` *dir*
: Specifies the destination directory for DOT file output. If this option is
specified, then the `jdeps`command generates one `.dot` file for each
analyzed archive named `archive-file-name.dot` that lists the dependencies,
and also a summary file named `summary.dot` that lists the dependencies
among the archive files.
`-s` or `-summary`
: Prints a dependency summary only.
`-v` or `-verbose`
: Prints all class-level dependencies. This is equivalent to
> `-verbose:class -filter:none`
`-verbose:package`
: Prints package-level dependencies excluding, by default, dependences within
the same package.
`-verbose:class`
: Prints class-level dependencies excluding, by default, dependencies within
the same archive.
`-apionly` or `--api-only`
: Restricts the analysis to APIs, for example, dependences from the signature
of `public` and `protected` members of public classes including field type,
method parameter types, returned type, and checked exception types.
`-jdkinternals` or `--jdk-internals`
: Finds class-level dependences in the JDK internal APIs. By default, this
option analyzes all classes specified in the `--classpath` option and input
files unless you specified the `-include` option. You can't use this option
with the `-p`, `-e`, and `-s` options.
**Warning**: The JDK internal APIs are inaccessible.
`-cp` *path*, `-classpath` *path*, or `--class-path` *path*
: Specifies where to find class files.
`--module-path` *module-path*
: Specifies the module path.
`--upgrade-module-path` *module-path*
: Specifies the upgrade module path.
`--system` *java-home*
: Specifies an alternate system module path.
`--add-modules` *module-name*\[`,` *module-name*...\]
: Adds modules to the root set for analysis.
`--multi-release` *version*
: Specifies the version when processing multi-release JAR files. *version*
should be an integer \>=9 or base.
`-q` or `-quiet`
: Doesn't show missing dependencies from `-generate-module-info` output.
`-version` or `--version`
: Prints version information.
## Module Dependence Analysis Options
`-m` *module-name* or `--module` *module-name*
: Specifies the root module for analysis.
`--generate-module-info` *dir*
: Generates `module-info.java` under the specified directory. The specified
JAR files will be analyzed. This option cannot be used with `--dot-output`
or `--class-path` options. Use the `--generate-open-module` option for open
modules.
`--generate-open-module` *dir*
: Generates `module-info.java` for the specified JAR files under the
specified directory as open modules. This option cannot be used with the
`--dot-output` or `--class-path` options.
`--check` *module-name* \[`,` *module-name*...\]
: Analyzes the dependence of the specified modules. It prints the module
descriptor, the resulting module dependences after analysis and the graph
after transition reduction. It also identifies any unused qualified
exports.
`--list-deps`
: Lists the module dependences and also the package names of JDK internal
APIs (if referenced). This option transitively analyzes libraries on
class path and module path if referenced. Use `--no-recursive` option for
non-transitive dependency analysis.
`--list-reduced-deps`
: Same as `--list-deps` without listing the implied reads edges from the
module graph. If module M1 reads M2, and M2 requires transitive on M3, then
M1 reading M3 is implied and is not shown in the graph.
`--print-module-deps`
: Same as `--list-reduced-deps` with printing a comma-separated list of
module dependences. The output can be used by `jlink --add-modules` to
create a custom image that contains those modules and their transitive
dependences.
`--ignore-missing-deps`
: Ignore missing dependences.
## Options to Filter Dependences
`-p` *pkg\_name*, `-package` *pkg\_name*, or `--package` *pkg\_name*
: Finds dependences matching the specified package name. You can specify this
option multiple times for different packages. The `-p` and `-e` options are
mutually exclusive.
`-e` *regex*, `-regex` *regex*, or `--regex` *regex*
: Finds dependences matching the specified pattern. The `-p` and `-e` options
are mutually exclusive.
`--require` *module-name*
: Finds dependences matching the given module name (may be given multiple
times). The `--package`, `--regex`, and `--require` options are mutually
exclusive.
`-f` *regex* or `-filter` *regex*
: Filters dependences matching the given pattern. If give multiple times, the
last one will be selected.
`-filter:package`
: Filters dependences within the same package. This is the default.
`-filter:archive`
: Filters dependences within the same archive.
`-filter:module`
: Filters dependences within the same module.
`-filter:none`
: No `-filter:package` and `-filter:archive` filtering. Filtering specified
via the `-filter` option still applies.
`--missing-deps`
: Finds missing dependences. This option cannot be used with `-p`, `-e` and
`-s` options.
## Options to Filter Classes to be Analyzed
`-include` *regex*
: Restricts analysis to the classes matching pattern. This option filters the
list of classes to be analyzed. It can be used together with `-p` and `-e`,
which apply the pattern to the dependencies.
`-R` or `--recursive`
: Recursively traverses all run-time dependences. The `-R` option implies
`-filter:none`. If `-p`, `-e`, or `-f` options are specified, only the
matching dependences are analyzed.
`--no-recursive`
: Do not recursively traverse dependences.
`-I` or `--inverse`
: Analyzes the dependences per other given options and then finds all
artifacts that directly and indirectly depend on the matching nodes. This
is equivalent to the inverse of the compile-time view analysis and the
print dependency summary. This option must be used with the `--require`,
`--package`, or `--regex` options.
`--compile-time`
: Analyzes the compile-time view of transitive dependencies, such as the
compile-time view of the `-R` option. Analyzes the dependences per other
specified options. If a dependency is found from a directory, a JAR file or
a module, all classes in that containing archive are analyzed.
## Example of Analyzing Dependencies
The following example demonstrates analyzing the dependencies of the
`Notepad.jar` file.
**Linux and macOS:**
```
$ jdeps demo/jfc/Notepad/Notepad.jar
Notepad.jar -> java.base
Notepad.jar -> java.desktop
Notepad.jar -> java.logging
<unnamed> (Notepad.jar)
-> java.awt
-> java.awt.event
-> java.beans
-> java.io
-> java.lang
-> java.net
-> java.util
-> java.util.logging
-> javax.swing
-> javax.swing.border
-> javax.swing.event
-> javax.swing.text
-> javax.swing.tree
-> javax.swing.undo
```
**Windows:**
```
C:\Java\jdk1.9.0>jdeps demo\jfc\Notepad\Notepad.jar
Notepad.jar -> java.base
Notepad.jar -> java.desktop
Notepad.jar -> java.logging
<unnamed> (Notepad.jar)
-> java.awt
-> java.awt.event
-> java.beans
-> java.io
-> java.lang
-> java.net
-> java.util
-> java.util.logging
-> javax.swing
-> javax.swing.border
-> javax.swing.event
-> javax.swing.text
-> javax.swing.tree
-> javax.swing.undo
```
## Example Using the --inverse Option
```
$ jdeps --inverse --require java.xml.bind
Inverse transitive dependences on [java.xml.bind]
java.xml.bind <- java.se.ee
java.xml.bind <- jdk.xml.ws
java.xml.bind <- java.xml.ws <- java.se.ee
java.xml.bind <- java.xml.ws <- jdk.xml.ws
java.xml.bind <- jdk.xml.bind <- jdk.xml.ws
```

View File

@ -1,220 +0,0 @@
.\" Copyright (c) 2024, 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.19.2
.\"
.\" Define V font for inline verbatim, using C font in formats
.\" that render this, and otherwise B font.
.ie "\f[CB]x\f[R]"x" \{\
. ftr V B
. ftr VI BI
. ftr VB B
. ftr VBI BI
.\}
.el \{\
. ftr V CR
. ftr VI CI
. ftr VB CB
. ftr VBI CBI
.\}
.TH "JNATIVESCAN" "1" "2025" "JDK 24-ea" "JDK Commands"
.hy
.SH NAME
.PP
jnativescan - static analysis tool that scans one or more jar files for
uses of native functionalities, such as restricted method calls or
\f[V]native\f[R] method declarations.
.SH SYNOPSIS
.PP
\f[V]jnativescan\f[R] [\f[I]options\f[R]]
.TP
\f[I]options\f[R]
See \f[B]Options for the jnativescan Command\f[R]
.SH DESCRIPTION
.PP
The \f[V]jnative\f[R] tool is a static analysis tool provided by the JDK
that scans a JAR file for uses of native functionalities, such as
restricted method calls or \f[V]native\f[R] method declarations.
.PP
\f[V]jnativescan\f[R] accepts a runtime class path and module path
configuration, as well as a set of root modules, and a target release.
It scans the jars on the class and module paths, and reports uses of
native functionalities either in a tree like structure, which also
identifies that calling classes and methods, or as a list of module
names when the \f[V]--print-native-access\f[R] flag is specified.
.SH OPTIONS FOR THE JNATIVESCAN COMMAND
.PP
The following options are available:
.TP
\f[V]--class-path\f[R] \f[I]path\f[R]
Used to specify a list of paths pointing to jar files to be scanned.
.PP
All jar files specified through this list will be scanned.
If a jar file contains a \f[V]Class-Path\f[R] attribute in its manifest,
jar files listed there will be scanned as well.
Jar files listed in the \f[V]Class-Path\f[R] manifest attribute that can
not be found are ignored.
All the jar files found are treated as if they belonged to the unnamed
module.
.TP
\f[V]--module-path\f[R] \f[I]path\f[R]
Used to specify a list of paths pointing to jar files or directories
containing jar files, that the tool can use to find modules that need to
be scanned.
The list of jar files that will be scanned depends on the
\f[V]--add-modules\f[R] option.
.RS
.PP
For both the \f[V]--class-path\f[R] and \f[V]--module-path\f[R] options,
\f[I]path\f[R] should be a search path that consists of one or more jar
files, separated by the system-specific path separator.
For example:
.IP \[bu] 2
\f[B]Linux and macOS:\f[R]
.RS 2
.RS
.PP
\f[V]--class-path /some/foo.jar:/another/different/bar.jar\f[R]
.RE
.RE
.PP
\f[B]Note:\f[R]
.PP
On Windows, use a semicolon (\f[V];\f[R]) as the separator instead of a
colon (\f[V]:\f[R]).
.IP \[bu] 2
\f[B]Windows:\f[R]
.RS 2
.RS
.PP
\f[V]--class-path C:\[rs]some\[rs]foo.jar;C:\[rs]another\[rs]different\[rs]bar.jar\f[R]
.RE
.RE
.RE
.TP
\f[V]--add-modules\f[R] \f[I]module[,module...]\f[R]
Used to specify a comma-separated list of module names that indicate the
root modules to scan.
All the root modules will be scanned, as well as any modules that they
depend on.
This includes dependencies on service implementations specified through
the \f[V]uses\f[R] directive in a module\[aq]s \f[V]module-info\f[R]
file.
All modules found on the module path that provide an implementation of
such a service will be scanned as well.
.TP
\f[V]--release\f[R] \f[I]version\f[R]
Used to specify the Java SE release that specifies the set of restricted
methods to scan for.
For multi-release jar files, this option also indicates the version of
class file that should be loaded from the jar.
This option should be set to the version of the runtime under which the
application is eventually intended to be run.
If this flag is omitted, the version of \f[V]jnativescan\f[R] is used as
release version, which is the same as the version of the JDK that the
tool belongs to.
.TP
\f[V]--print-native-access\f[R]
Print a comma-separated list of module names that use native
functionalities, instead of the default tree structure.
.TP
\f[V]--help\f[R] or \f[V]-h\f[R]
Prints out a full help message.
.TP
\f[V]--version\f[R]
Prints out the abbreviated version string of the tool.
.SH EXAMPLE OF \f[V]jnativescan\f[R] USE
.PP
\f[V]jnativescan\f[R] accepts a runtime configuration in the form of a
class path, module path, set of root modules, and a target release
version.
For the class path, the tool will scan all jar files, including those
found recursively through the \f[V]Class-Path\f[R] manifest attribute.
For the module path, the tool scans all root modules specified through
\f[V]--add-modules\f[R], and any (transitive) dependence of the root
modules, including any modules that contain service implementations that
are used by a scanned module.
.PP
By default, the tool prints out which jars, classes, and methods use
native functionalities, in a tree-like structure.
The following is an example output:
.IP
.nf
\f[CB]
$ jnativescan --class-path app.jar
app.jar (ALL-UNNAMED):
foo.Main:
foo.Main::main(String[])void references restricted methods:
java.lang.foreign.MemorySegment::reinterpret(long)MemorySegment
foo.Main::nativeMethod()void is a native method declaration
\f[R]
.fi
.PP
\f[V]app.jar (ALL-UNNAMED)\f[R] is the path to the jar file, with the
module name in parentheses behind it.
Since in this case the jar file appears on the class path,
\f[V]ALL-UNNAMED\f[R] is printed to indicate the unnamed module.
The second line of the output, \f[V]foo.Main\f[R], indicates that
methods using native functionalities were found in the
\f[V]foo.Main\f[R] class.
The next line:
.IP
.nf
\f[CB]
foo.Main::main(String[])void references restricted methods:
\f[R]
.fi
.PP
Indicates that the \f[V]main(String[])\f[R] method in the
\f[V]foo.Main\f[R] class references a restricted method, which is listed
on the following line as:
.IP
.nf
\f[CB]
java.lang.foreign.MemorySegment::reinterpret(long)MemorySegment
\f[R]
.fi
.PP
Lastly, the text:
.IP
.nf
\f[CB]
foo.Main::nativeMethod()void is a native method declaration
\f[R]
.fi
.PP
Indicates that the \f[V]foo.Main\f[R] class contains a declaration of a
\f[V]native\f[R] method named \f[V]nativeMethod\f[R].
.PP
If we add \f[V]--print-native-access\f[R] to the example command line,
we instead get a list of the names of modules that contain accesses to
native functionalities:
.IP
.nf
\f[CB]
$ jnativescan --class-path app.jar --print-native-access
ALL-UNNAMED
\f[R]
.fi
.PP
In this case the output consists of just \f[V]ALL-UNNAMED\f[R], which
indicates a jar file on the class path, that is, in the unnamed module,
contains an access to native functionalities.

View File

@ -0,0 +1,175 @@
---
# Copyright (c) 2024, 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.
#
title: 'JNATIVESCAN(1) JDK @@VERSION_SHORT@@ | JDK Commands'
date: @@COPYRIGHT_YEAR@@
lang: en
---
## Name
jnativescan - static analysis tool that scans one or more jar files for uses of
native functionalities, such as restricted method calls or `native` method declarations.
## Synopsis
`jnativescan` \[*options*\]
*options*
: See [Options for the jnativescan Command]
## Description
The `jnative` tool is a static analysis tool provided by the JDK that scans a
JAR file for uses of native functionalities, such as restricted method calls
or `native` method declarations.
`jnativescan` accepts a runtime class path and module path configuration, as
well as a set of root modules, and a target release. It scans the jars on the
class and module paths, and reports uses of native functionalities either in a tree
like structure, which also identifies that calling classes and methods, or as a list
of module names when the `--print-native-access` flag is specified.
## Options for the jnativescan Command
The following options are available:
`--class-path` *path*
: Used to specify a list of paths pointing to jar files to be scanned.
All jar files specified through this list will be scanned. If a jar file
contains a `Class-Path` attribute in its manifest, jar files listed there
will be scanned as well. Jar files listed in the `Class-Path` manifest
attribute that can not be found are ignored. All the jar files found are
treated as if they belonged to the unnamed module.
`--module-path` *path*
: Used to specify a list of paths pointing to jar files or directories
containing jar files, that the tool can use to find modules that need
to be scanned. The list of jar files that will be scanned depends on the
`--add-modules` option.
For both the `--class-path` and `--module-path` options, *path* should
be a search path that consists of one or more jar files, separated by
the system-specific path separator. For example:
- **Linux and macOS:**
> `--class-path /some/foo.jar:/another/different/bar.jar`
**Note:**
On Windows, use a semicolon (`;`) as the separator instead of a colon
(`:`).
- **Windows:**
> `--class-path C:\some\foo.jar;C:\another\different\bar.jar`
`--add-modules` *module[,module...]*
: Used to specify a comma-separated list of module names that indicate
the root modules to scan. All the root modules will be scanned,
as well as any modules that they depend on. This includes dependencies on
service implementations specified through the `uses` directive in a module's
`module-info` file. All modules found on the module path that provide an
implementation of such a service will be scanned as well.
`--release` *version*
: Used to specify the Java SE release that specifies the set of restricted
methods to scan for. For multi-release jar files, this option also indicates
the version of class file that should be loaded from the jar. This option
should be set to the version of the runtime under which the application is
eventually intended to be run. If this flag is omitted, the version of
`jnativescan` is used as release version, which is the same as the version of
the JDK that the tool belongs to.
`--print-native-access`
: Print a comma-separated list of module names that use native functionalities,
instead of the default tree structure.
`--help` or `-h`
: Prints out a full help message.
`--version`
: Prints out the abbreviated version string of the tool.
## Example of `jnativescan` use
`jnativescan` accepts a runtime configuration in the form of a class path, module
path, set of root modules, and a target release version. For the class path, the
tool will scan all jar files, including those found recursively through the
`Class-Path` manifest attribute. For the module path, the tool scans all root
modules specified through `--add-modules`, and any (transitive) dependence of
the root modules, including any modules that contain service implementations that
are used by a scanned module.
By default, the tool prints out which jars, classes, and methods use native
functionalities, in a tree-like structure. The following is an example output:
```
$ jnativescan --class-path app.jar
app.jar (ALL-UNNAMED):
foo.Main:
foo.Main::main(String[])void references restricted methods:
java.lang.foreign.MemorySegment::reinterpret(long)MemorySegment
foo.Main::nativeMethod()void is a native method declaration
```
`app.jar (ALL-UNNAMED)` is the path to the jar file, with the module name in
parentheses behind it. Since in this case the jar file appears on the class
path, `ALL-UNNAMED` is printed to indicate the unnamed module. The second line
of the output, `foo.Main`, indicates that methods using native functionalities
were found in the `foo.Main` class. The next line:
```
foo.Main::main(String[])void references restricted methods:
```
Indicates that the `main(String[])` method in the `foo.Main` class references
a restricted method, which is listed on the following line as:
```
java.lang.foreign.MemorySegment::reinterpret(long)MemorySegment
```
Lastly, the text:
```
foo.Main::nativeMethod()void is a native method declaration
```
Indicates that the `foo.Main` class contains a declaration of a `native`
method named `nativeMethod`.
If we add `--print-native-access` to the example command line, we instead
get a list of the names of modules that contain accesses to native
functionalities:
```
$ jnativescan --class-path app.jar --print-native-access
ALL-UNNAMED
```
In this case the output consists of just `ALL-UNNAMED`, which indicates
a jar file on the class path, that is, in the unnamed module, contains an access
to native functionalities.

View File

@ -1,277 +0,0 @@
.\" Copyright (c) 1995, 2023, 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.19.2
.\"
.\" Define V font for inline verbatim, using C font in formats
.\" that render this, and otherwise B font.
.ie "\f[CB]x\f[R]"x" \{\
. ftr V B
. ftr VI BI
. ftr VB B
. ftr VBI BI
.\}
.el \{\
. ftr V CR
. ftr VI CI
. ftr VB CB
. ftr VBI CBI
.\}
.TH "JDB" "1" "2025" "JDK 24-ea" "JDK Commands"
.hy
.SH NAME
.PP
jdb - find and fix bugs in Java platform programs
.SH SYNOPSIS
.PP
\f[V]jdb\f[R] [\f[I]options\f[R]] [\f[I]classname\f[R]]
[\f[I]arguments\f[R]]
.TP
\f[I]options\f[R]
This represents the \f[V]jdb\f[R] command-line options.
See \f[B]Options for the jdb command\f[R].
.TP
\f[I]classname\f[R]
This represents the name of the main class to debug.
.TP
\f[I]arguments\f[R]
This represents the arguments that are passed to the \f[V]main()\f[R]
method of the class.
.SH DESCRIPTION
.PP
The Java Debugger (JDB) is a simple command-line debugger for Java
classes.
The \f[V]jdb\f[R] command and its options call the JDB.
The \f[V]jdb\f[R] command demonstrates the Java Platform Debugger
Architecture and provides inspection and debugging of a local or remote
JVM.
.SH START A JDB SESSION
.PP
There are many ways to start a JDB session.
The most frequently used way is to have the JDB launch a new JVM with
the main class of the application to be debugged.
Do this by substituting the \f[V]jdb\f[R] command for the \f[V]java\f[R]
command in the command line.
For example, if your application\[aq]s main class is \f[V]MyClass\f[R],
then use the following command to debug it under the JDB:
.RS
.PP
\f[V]jdb MyClass\f[R]
.RE
.PP
When started this way, the \f[V]jdb\f[R] command calls a second JVM with
the specified parameters, loads the specified class, and stops the JVM
before executing that class\[aq]s first instruction.
.PP
Another way to use the \f[V]jdb\f[R] command is by attaching it to a JVM
that\[aq]s already running.
Syntax for starting a JVM to which the \f[V]jdb\f[R] command attaches
when the JVM is running is as follows.
This loads in-process debugging libraries and specifies the kind of
connection to be made.
.RS
.PP
\f[V]java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n MyClass\f[R]
.RE
.PP
You can then attach the \f[V]jdb\f[R] command to the JVM with the
following command:
.RS
.PP
\f[V]jdb -attach 8000\f[R]
.RE
.PP
8000 is the address of the running JVM.
.PP
The \f[V]MyClass\f[R] argument isn\[aq]t specified in the \f[V]jdb\f[R]
command line in this case because the \f[V]jdb\f[R] command is
connecting to an existing JVM instead of launching a new JVM.
.PP
There are many other ways to connect the debugger to a JVM, and all of
them are supported by the \f[V]jdb\f[R] command.
The Java Platform Debugger Architecture has additional documentation on
these connection options.
.SH BREAKPOINTS
.PP
Breakpoints can be set in the JDB at line numbers or at the first
instruction of a method, for example:
.IP \[bu] 2
The command \f[V]stop at MyClass:22\f[R] sets a breakpoint at the first
instruction for line 22 of the source file containing \f[V]MyClass\f[R].
.IP \[bu] 2
The command \f[V]stop in java.lang.String.length\f[R] sets a breakpoint
at the beginning of the method \f[V]java.lang.String.length\f[R].
.IP \[bu] 2
The command \f[V]stop in MyClass.<clinit>\f[R] uses \f[V]<clinit>\f[R]
to identify the static initialization code for \f[V]MyClass\f[R].
.PP
When a method is overloaded, you must also specify its argument types so
that the proper method can be selected for a breakpoint.
For example, \f[V]MyClass.myMethod(int,java.lang.String)\f[R] or
\f[V]MyClass.myMethod()\f[R].
.PP
The \f[V]clear\f[R] command removes breakpoints using the following
syntax: \f[V]clear MyClass:45\f[R].
Using the \f[V]clear\f[R] or \f[V]stop\f[R] command with no argument
displays a list of all breakpoints currently set.
The \f[V]cont\f[R] command continues execution.
.SH STEPPING
.PP
The \f[V]step\f[R] command advances execution to the next line whether
it\[aq]s in the current stack frame or a called method.
The \f[V]next\f[R] command advances execution to the next line in the
current stack frame.
.SH EXCEPTIONS
.PP
When an exception occurs for which there isn\[aq]t a \f[V]catch\f[R]
statement anywhere in the throwing thread\[aq]s call stack, the JVM
typically prints an exception trace and exits.
When running under the JDB, however, control returns to the JDB at the
offending throw.
You can then use the \f[V]jdb\f[R] command to diagnose the cause of the
exception.
.PP
Use the \f[V]catch\f[R] command to cause the debugged application to
stop at other thrown exceptions, for example:
\f[V]catch java.io.FileNotFoundException\f[R] or \f[V]catch\f[R]
\f[V]mypackage.BigTroubleException\f[R].
Any exception that\[aq]s an instance of the specified class or subclass
stops the application at the point where the exception is thrown.
.PP
The \f[V]ignore\f[R] command negates the effect of an earlier
\f[V]catch\f[R] command.
The \f[V]ignore\f[R] command doesn\[aq]t cause the debugged JVM to
ignore specific exceptions, but only to ignore the debugger.
.SH OPTIONS FOR THE JDB COMMAND
.PP
When you use the \f[V]jdb\f[R] command instead of the \f[V]java\f[R]
command on the command line, the \f[V]jdb\f[R] command accepts many of
the same options as the \f[V]java\f[R] command.
.PP
The following options are accepted by the \f[V]jdb\f[R] command:
.TP
\f[V]-help\f[R]
Displays a help message.
.TP
\f[V]-sourcepath\f[R] \f[I]dir1\f[R]\f[V]:\f[R]\f[I]dir2\f[R]\f[V]:\f[R]...
Uses the specified path to search for source files in the specified
path.
If this option is not specified, then use the default path of dot
(\f[V].\f[R]).
.TP
\f[V]-attach\f[R] \f[I]address\f[R]
Attaches the debugger to a running JVM with the default connection
mechanism.
.TP
\f[V]-listen\f[R] \f[I]address\f[R]
Waits for a running JVM to connect to the specified address with a
standard connector.
.TP
\f[V]-listenany\f[R]
Waits for a running JVM to connect at any available address using a
standard connector.
.TP
\f[V]-launch\f[R]
Starts the debugged application immediately upon startup of the
\f[V]jdb\f[R] command.
The \f[V]-launch\f[R] option removes the need for the \f[V]run\f[R]
command.
The debugged application is launched and then stopped just before the
initial application class is loaded.
At that point, you can set any necessary breakpoints and use the
\f[V]cont\f[R] command to continue execution.
.TP
\f[V]-listconnectors\f[R]
Lists the connectors available in this JVM.
.TP
\f[V]-connect\f[R] \f[I]connector-name\f[R]\f[V]:\f[R]\f[I]name1\f[R]\f[V]=\f[R]\f[I]value1\f[R]....
Connects to the target JVM with the named connector and listed argument
values.
.TP
\f[V]-dbgtrace\f[R] [\f[I]flags\f[R]]
Prints information for debugging the \f[V]jdb\f[R] command.
.TP
\f[V]-tclient\f[R]
Runs the application in the Java HotSpot VM client.
.TP
\f[V]-trackallthreads\f[R]
Track all threads as they are created, including virtual threads.
See \f[B]Working With Virtual Threads\f[R] below.
.TP
\f[V]-tserver\f[R]
Runs the application in the Java HotSpot VM server.
.TP
\f[V]-J\f[R]\f[I]option\f[R]
Passes \f[I]option\f[R] to the JDB JVM, where option is one of the
options described on the reference page for the Java application
launcher.
For example, \f[V]-J-Xms48m\f[R] sets the startup memory to 48 MB.
See \f[I]Overview of Java Options\f[R] in \f[B]java\f[R].
.PP
The following options are forwarded to the debuggee process:
.TP
\f[V]-R\f[R]\f[I]option\f[R]
Passes \f[I]option\f[R] to the debuggee JVM, where option is one of the
options described on the reference page for the Java application
launcher.
For example, \f[V]-R-Xms48m\f[R] sets the startup memory to 48 MB.
See \f[I]Overview of Java Options\f[R] in \f[B]java\f[R].
.TP
\f[V]-v\f[R] or \f[V]-verbose\f[R][\f[V]:\f[R]\f[I]class\f[R]|\f[V]gc\f[R]|\f[V]jni\f[R]]
Turns on the verbose mode.
.TP
\f[V]-D\f[R]\f[I]name\f[R]\f[V]=\f[R]\f[I]value\f[R]
Sets a system property.
.TP
\f[V]-classpath\f[R] \f[I]dir\f[R]
Lists directories separated by colons in which to look for classes.
.TP
\f[V]-X\f[R] \f[I]option\f[R]
A nonstandard target JVM option.
.PP
Other options are supported to provide alternate mechanisms for
connecting the debugger to the JVM that it\[aq]s to debug.
.SH WORKING WITH VIRTUAL THREADS
.PP
Often virtual theads are created in such large numbers and frequency
that they can overwhelm a debugger.
For this reason by default JDB does not keep track of virtual threads as
they are created.
It will only keep track of virtual threads that an event has arrived on,
such as a breakpoint event.
The \f[V]-trackallthreads\f[R] option can be used to make JDB track all
virtual threads as they are created.
.PP
When JDB first connects, it requests a list of all known threads from
the Debug Agent.
By default the debug agent does not return any virtual threads in this
list, once again because the list could be so large that it overwhelms
the debugger.
The Debug Agent has an \f[V]includevirtualthreads\f[R] option that can
be enabled to change this behavior so all known virtual threads will be
included in the list.
The JDB \f[V]-trackallthreads\f[R] option will cause JDB to
automatically enable the Debug Agent\[aq]s
\f[V]includevirtualthreads\f[R] option when JDB launches an application
to debug.
However, keep in mind that the Debug Agent may not know about any
virtual threads that were created before JDB attached to the debugged
application.

View File

@ -0,0 +1,237 @@
---
# Copyright (c) 1995, 2023, 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.
#
title: 'JDB(1) JDK @@VERSION_SHORT@@ | JDK Commands'
date: @@COPYRIGHT_YEAR@@
lang: en
---
## Name
jdb - find and fix bugs in Java platform programs
## Synopsis
`jdb` \[*options*\] \[*classname*\] \[*arguments*\]
*options*
: This represents the `jdb` command-line options. See [Options for the jdb
command].
*classname*
: This represents the name of the main class to debug.
*arguments*
: This represents the arguments that are passed to the `main()` method of the
class.
## Description
The Java Debugger (JDB) is a simple command-line debugger for Java classes. The
`jdb` command and its options call the JDB. The `jdb` command demonstrates the
Java Platform Debugger Architecture and provides inspection and debugging of a
local or remote JVM.
## Start a JDB Session
There are many ways to start a JDB session. The most frequently used way is to
have the JDB launch a new JVM with the main class of the application to be
debugged. Do this by substituting the `jdb` command for the `java` command in
the command line. For example, if your application's main class is `MyClass`,
then use the following command to debug it under the JDB:
> `jdb MyClass`
When started this way, the `jdb` command calls a second JVM with the specified
parameters, loads the specified class, and stops the JVM before executing that
class's first instruction.
Another way to use the `jdb` command is by attaching it to a JVM that's already
running. Syntax for starting a JVM to which the `jdb` command attaches when the
JVM is running is as follows. This loads in-process debugging libraries and
specifies the kind of connection to be made.
> `java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n MyClass`
You can then attach the `jdb` command to the JVM with the following command:
> `jdb -attach 8000`
8000 is the address of the running JVM.
The `MyClass` argument isn't specified in the `jdb` command line in this case
because the `jdb` command is connecting to an existing JVM instead of launching
a new JVM.
There are many other ways to connect the debugger to a JVM, and all of them are
supported by the `jdb` command. The Java Platform Debugger Architecture has
additional documentation on these connection options.
## Breakpoints
Breakpoints can be set in the JDB at line numbers or at the first instruction
of a method, for example:
- The command `stop at MyClass:22` sets a breakpoint at the first instruction
for line 22 of the source file containing `MyClass`.
- The command `stop in java.lang.String.length` sets a breakpoint at the
beginning of the method `java.lang.String.length`.
- The command `stop in MyClass.<clinit>` uses `<clinit>` to identify the
static initialization code for `MyClass`.
When a method is overloaded, you must also specify its argument types so that
the proper method can be selected for a breakpoint. For example,
`MyClass.myMethod(int,java.lang.String)` or `MyClass.myMethod()`.
The `clear` command removes breakpoints using the following syntax:
`clear MyClass:45`. Using the `clear` or `stop` command with no argument
displays a list of all breakpoints currently set. The `cont` command continues
execution.
## Stepping
The `step` command advances execution to the next line whether it's in the
current stack frame or a called method. The `next` command advances execution
to the next line in the current stack frame.
## Exceptions
When an exception occurs for which there isn't a `catch` statement anywhere in
the throwing thread's call stack, the JVM typically prints an exception trace
and exits. When running under the JDB, however, control returns to the JDB at
the offending throw. You can then use the `jdb` command to diagnose the cause
of the exception.
Use the `catch` command to cause the debugged application to stop at other
thrown exceptions, for example: `catch java.io.FileNotFoundException` or
`catch` `mypackage.BigTroubleException`. Any exception that's an instance of
the specified class or subclass stops the application at the point where the
exception is thrown.
The `ignore` command negates the effect of an earlier `catch` command. The
`ignore` command doesn't cause the debugged JVM to ignore specific exceptions,
but only to ignore the debugger.
## Options for the jdb command
When you use the `jdb` command instead of the `java` command on the command
line, the `jdb` command accepts many of the same options as the `java`
command.
The following options are accepted by the `jdb` command:
`-help`
: Displays a help message.
`-sourcepath` *dir1*`:`*dir2*`:`...
: Uses the specified path to search for source files in the specified path.
If this option is not specified, then use the default path of dot (`.`).
`-attach` *address*
: Attaches the debugger to a running JVM with the default connection
mechanism.
`-listen` *address*
: Waits for a running JVM to connect to the specified address with a standard
connector.
`-listenany`
: Waits for a running JVM to connect at any available address using a
standard connector.
`-launch`
: Starts the debugged application immediately upon startup of the `jdb`
command. The `-launch` option removes the need for the `run` command. The
debugged application is launched and then stopped just before the initial
application class is loaded. At that point, you can set any necessary
breakpoints and use the `cont` command to continue execution.
`-listconnectors`
: Lists the connectors available in this JVM.
`-connect` *connector-name*`:`*name1*`=`*value1*....
: Connects to the target JVM with the named connector and listed argument
values.
`-dbgtrace` \[*flags*\]
: Prints information for debugging the `jdb` command.
`-tclient`
: Runs the application in the Java HotSpot VM client.
`-trackallthreads`
: Track all threads as they are created, including virtual threads.
See [Working With Virtual Threads](#working-with-virtual-threads) below.
`-tserver`
: Runs the application in the Java HotSpot VM server.
`-J`*option*
: Passes *option* to the JDB JVM, where option is one of the options described on
the reference page for the Java application launcher. For example,
`-J-Xms48m` sets the startup memory to 48 MB. See *Overview of Java
Options* in [java](java.html).
The following options are forwarded to the debuggee process:
`-R`*option*
: Passes *option* to the debuggee JVM, where option is one of the options described on
the reference page for the Java application launcher. For example,
`-R-Xms48m` sets the startup memory to 48 MB. See *Overview of Java
Options* in [java](java.html).
`-v` or `-verbose`\[`:`*class*\|`gc`\|`jni`\]
: Turns on the verbose mode.
`-D`*name*`=`*value*
: Sets a system property.
`-classpath` *dir*
: Lists directories separated by colons in which to look for classes.
`-X` *option*
: A nonstandard target JVM option.
Other options are supported to provide alternate mechanisms for connecting the
debugger to the JVM that it's to debug.
## Working With Virtual Threads
Often virtual theads are created in such large numbers and frequency that they
can overwhelm a debugger. For this reason by default JDB does not keep track
of virtual threads as they are created. It will only keep track of virtual
threads that an event has arrived on, such as a breakpoint event. The
`-trackallthreads` option can be used to make JDB track all virtual threads
as they are created.
When JDB first connects, it requests a list of all known threads from the Debug Agent.
By default the debug agent does not return any virtual threads in this list, once
again because the list could be so large that it overwhelms the debugger. The
Debug Agent has an `includevirtualthreads` option that can be enabled to change
this behavior so all known virtual threads will be included in the list. The
JDB `-trackallthreads` option will cause JDB to automatically enable the Debug Agent's
`includevirtualthreads` option when JDB launches an application to debug. However, keep in mind
that the Debug Agent may not know about any virtual threads that were created
before JDB attached to the debugged application.

View File

@ -1,438 +0,0 @@
.\" Copyright (c) 2019, 2023, 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.19.2
.\"
.\" Define V font for inline verbatim, using C font in formats
.\" that render this, and otherwise B font.
.ie "\f[CB]x\f[R]"x" \{\
. ftr V B
. ftr VI BI
. ftr VB B
. ftr VBI BI
.\}
.el \{\
. ftr V CR
. ftr VI CI
. ftr VB CB
. ftr VBI CBI
.\}
.TH "JFR" "1" "2025" "JDK 24-ea" "JDK Commands"
.hy
.SH NAME
.PP
jfr - print and manipulate Flight Recorder files
.SH SYNOPSIS
.PP
To print the contents of a flight recording to standard out:
.PP
\f[V]jfr\f[R] \f[V]print\f[R] [\f[I]options\f[R]] \f[I]file\f[R]
.PP
To display aggregated event data on standard out:
.PP
\f[V]jfr\f[R] \f[V]view\f[R] [\f[I]options\f[R]] \f[I]file\f[R]
.PP
To configure a .jfc settings file:
.PP
\f[V]jfr\f[R] \f[V]configure\f[R] [\f[I]options\f[R]]
.PP
To print metadata information about flight recording events:
.PP
\f[V]jfr\f[R] \f[V]metadata\f[R] [\f[I]file\f[R]]
.PP
To view the summary statistics for a flight recording file:
.PP
\f[V]jfr\f[R] \f[V]summary\f[R] \f[I]file\f[R]
.PP
To remove events from a flight recording file:
.PP
\f[V]jfr\f[R] \f[V]scrub\f[R] [\f[I]options\f[R]] \f[I]file\f[R]
.PP
To assemble chunk files into a flight recording file:
.PP
\f[V]jfr\f[R] \f[V]assemble\f[R] \f[I]repository\f[R] \f[I]file\f[R]
.PP
To disassemble a flight recording file into chunk files:
.PP
\f[V]jfr\f[R] \f[V]disassmble\f[R] [\f[I]options\f[R]] \f[I]file\f[R]
.TP
\f[I]options\f[R]
Optional: Specifies command-line options separated by spaces.
See the individual subcomponent sections for descriptions of the
available options.
.TP
\f[I]file\f[R]
Specifies the name of the target flight recording file (\f[V].jfr\f[R]).
.TP
\f[I]repository\f[R]
Specifies the location of the chunk files which are to be assembled into
a flight recording.
.SH DESCRIPTION
.PP
The \f[V]jfr\f[R] command provides a tool for interacting with flight
recorder files (\f[V].jfr\f[R]).
The main function is to filter, summarize and output flight recording
files into human readable format.
There is also support for scrubbing, merging and splitting recording
files.
.PP
Flight recording files are created and saved as binary formatted files.
Having a tool that can extract the contents from a flight recording and
manipulate the contents and translate them into human readable format
helps developers to debug performance issues with Java applications.
.SS Subcommands
.PP
The \f[V]jfr\f[R] command has several subcommands:
.IP \[bu] 2
\f[V]print\f[R]
.IP \[bu] 2
\f[V]view\f[R]
.IP \[bu] 2
\f[V]configure\f[R]
.IP \[bu] 2
\f[V]metadata\f[R]
.IP \[bu] 2
\f[V]summary\f[R]
.IP \[bu] 2
\f[V]scrub\f[R]
.IP \[bu] 2
\f[V]assemble\f[R]
.IP \[bu] 2
\f[V]disassemble\f[R]
.SS \f[V]jfr print\f[R] subcommand
.PP
Use \f[V]jfr print\f[R] to print the contents of a flight recording file
to standard out.
.PP
The syntax is:
.PP
\f[V]jfr print\f[R] [\f[V]--xml\f[R]|\f[V]--json\f[R]]
[\f[V]--categories\f[R] <\f[I]filters\f[R]>] [\f[V]--events\f[R]
<\f[I]filters\f[R]>] [\f[V]--stack-depth\f[R] <\f[I]depth\f[R]>]
<\f[I]file\f[R]>
.PP
where:
.TP
\f[V]--xml\f[R]
Print the recording in XML format.
.TP
\f[V]--json\f[R]
Print the recording in JSON format.
.TP
\f[V]--categories\f[R] <\f[I]filters\f[R]>
Select events matching a category name.
The filter is a comma-separated list of names, simple and/or qualified,
and/or quoted glob patterns.
.TP
\f[V]--events\f[R] <\f[I]filters\f[R]>
Select events matching an event name.
The filter is a comma-separated list of names, simple and/or qualified,
and/or quoted glob patterns.
.TP
\f[V]--stack-depth\f[R] <\f[I]depth\f[R]>
Number of frames in stack traces, by default 5.
.TP
<\f[I]file\f[R]>
Location of the recording file (\f[V].jfr\f[R])
.PP
The default format for printing the contents of the flight recording
file is human readable form unless either \f[V]xml\f[R] or
\f[V]json\f[R] is specified.
These options provide machine-readable output that can be further parsed
or processed by user created scripts.
.PP
Use \f[V]jfr --help print\f[R] to see example usage of filters.
.PP
To reduce the amount of data displayed, it is possible to filter out
events or categories of events.
The filter operates on the symbolic name of an event, set by using the
\f[V]\[at]Name\f[R] annotation, or the category name, set by using the
\f[V]\[at]Category\f[R] annotation.
If multiple filters are used, events from both filters will be included.
If no filter is used, all the events will be printed.
If a combination of a category filter and event filter is used, the
selected events will be the union of the two filters.
.PP
For example, to show all GC events and the CPULoad event, the following
command could be used:
.PP
\f[V]jfr print --categories GC --events CPULoad recording.jfr\f[R]
.PP
Event values are formatted according to the content types that are being
used.
For example, a field with the \f[V]jdk.jfr.Percentage\f[R] annotation
that has the value 0.52 is formatted as 52%.
.PP
Stack traces are by default truncated to 5 frames, but the number can be
increased/decreased using the \f[V]--stack-depth\f[R] command-line
option.
.SS \f[V]jfr view\f[R] subcommand
.PP
Use \f[V]jfr view\f[R] to aggregate and display event data on standard
out.
.PP
The syntax is:
.PP
\f[V]jfr view\f[R] [\f[V]--verbose\f[R]] [\f[V]--width\f[R]
<\f[I]integer\f[R]>] [\f[V]--truncate\f[R] <\f[I]mode\f[R]>]
[\f[V]--cell-height\f[R] <\f[I]integer\f[R]>] <\f[I]view\f[R]>
<\f[I]file\f[R]>
.PP
where:
.TP
\f[V]--verbose\f[R]
Displays the query that makes up the view.
.TP
\f[V]--width\f[R] <\f[I]integer\f[R]>
The width of the view in characters.
Default value depends on the view.
.TP
\f[V]--truncate\f[R] <\f[I]mode\f[R]>
How to truncate content that exceeds space in a table cell.
Mode can be \[aq]beginning\[aq] or \[aq]end\[aq].
Default value is \[aq]end\[aq].
.TP
\f[V]--cell-height\f[R] <\f[I]integer\f[R]>
Maximum number of rows in a table cell.
Default value depends on the view.
.TP
<\f[I]view\f[R]>
Name of the view or event type to display.
Use \f[V]jfr --help view\f[R] to see a list of available views.
.TP
<\f[I]file\f[R]>
Location of the recording file (.jfr)
.PP
The <\f[I]view\f[R]> parameter can be an event type name.
Use the \f[V]jfr view types <file>\f[R] to see a list.
To display all views, use \f[V]jfr view all-views <file>\f[R].
To display all events, use \f[V]jfr view all-events <file>\f[R].
.SS \f[V]jfr configure\f[R] subcommand
.PP
Use \f[V]jfr configure\f[R] to configure a .jfc settings file.
.PP
The syntax is:
.PP
\f[V]jfr configure\f[R] [--interactive] [--verbose] [--input ] [--output
] [option=value]* [event-setting=value]*
.TP
\f[V]--interactive\f[R]
Interactive mode where the configuration is determined by a set of
questions.
.TP
\f[V]--verbose\f[R]
Displays the modified settings.
.TP
\f[V]--input\f[R] <\f[I]files\f[R]>
A comma-separated list of .jfc files from which the new configuration is
based.
If no file is specified, the default file in the JDK is used
(default.jfc).
If \[aq]none\[aq] is specified, the new configuration starts empty.
.TP
\f[V]--output\f[R] <\f[I]file\f[R]>
The filename of the generated output file.
If not specified, the filename custom.jfc will be used.
.TP
\f[I]option=value\f[R]
The option value to modify.
To see available options, use \f[V]jfr help configure\f[R]
.TP
\f[I]event-setting=value\f[R]
The event setting value to modify.
Use the form:
<\f[I]event-name\f[R]>#<\f[I]setting-name\f[R]>=<\f[I]value\f[R]> To add
a new event setting, prefix the event name with \[aq]+\[aq].
.PP
The whitespace delimiter can be omitted for timespan values, i.e.
20ms.
For more information about the settings syntax, see Javadoc of the
jdk.jfr package.
.SS \f[V]jfr metadata\f[R] subcommand
.PP
Use \f[V]jfr metadata\f[R] to display information about events, such as
event names, categories and field layout within a flight recording file.
.PP
The syntax is:
.PP
\f[V]jfr metadata\f[R] [--categories ] [--events ] []
.TP
\f[V]--categories\f[R] <\f[I]filter\f[R]>
Select events matching a category name.
The filter is a comma-separated list of names, simple and/or qualified,
and/or quoted glob patterns.
.TP
\f[V]--events\f[R] <\f[I]filter\f[R]>
Select events matching an event name.
The filter is a comma-separated list of names, simple and/or qualified,
and/or quoted glob patterns.
.TP
<\f[I]file\f[R]>
Location of the recording file (.jfr)
.PP
If the parameter is omitted, metadata from the JDK where the
\[aq]jfr\[aq] tool is located will be used.
.SS \f[V]jfr summary\f[R] subcommand
.PP
Use \f[V]jfr summary\f[R] to print statistics for a recording.
For example, a summary can illustrate the number of recorded events and
how much disk space they used.
This is useful for troubleshooting and understanding the impact of event
settings.
.PP
The syntax is:
.PP
\f[V]jfr summary\f[R] <\f[I]file\f[R]>
.PP
where:
.TP
<\f[I]file\f[R]>
Location of the flight recording file (\f[V].jfr\f[R])
.SS \f[V]jfr scrub\f[R] subcommand
.PP
Use \f[V]jfr scrub\f[R] to remove sensitive contents from a file or to
reduce its size.
.PP
The syntax is:
.PP
\f[V]jfr scrub\f[R] [--include-events <\f[I]filter\f[R]>]
[--exclude-events <\f[I]filter\f[R]>] [--include-categories
<\f[I]filter\f[R]>] [--exclude-categories <\f[I]filter\f[R]>]
[--include-threads <\f[I]filter\f[R]>] [--exclude-threads
<\f[I]filter\f[R]>] <\f[I]input-file\f[R]> [<\f[I]output-file\f[R]>]
.TP
\f[V]--include-events\f[R] <\f[I]filter\f[R]>
Select events matching an event name.
.TP
\f[V]--exclude-events\f[R] <\f[I]filter\f[R]>
Exclude events matching an event name.
.TP
\f[V]--include-categories\f[R] <\f[I]filter\f[R]>
Select events matching a category name.
.TP
\f[V]--exclude-categories\f[R] <\f[I]filter\f[R]>
Exclude events matching a category name.
.TP
\f[V]--include-threads\f[R] <\f[I]filter\f[R]>
Select events matching a thread name.
.TP
\f[V]--exclude-threads\f[R] <\f[I]filter\f[R]>
Exclude events matching a thread name.
.TP
<\f[I]input-file\f[R]>
The input file to read events from.
.TP
<\f[I]output-file\f[R]>
The output file to write filter events to.
If no file is specified, it will be written to the same path as the
input file, but with \[dq]-scrubbed\[dq] appended to the filename.
.PP
The filter is a comma-separated list of names, simple and/or qualified,
and/or quoted glob patterns.
If multiple filters are used, they are applied in the specified order.
.SS \f[V]jfr assemble\f[R] subcommand
.PP
Use jfr \f[V]assemble\f[R] to assemble chunk files into a recording
file.
.PP
The syntax is:
.PP
\f[V]jfr assemble\f[R] <\f[I]repository\f[R]> <\f[I]file\f[R]>
.PP
where:
.TP
<\f[I]repository\f[R]>
Directory where the repository containing chunk files is located.
.TP
<\f[I]file\f[R]>
Location of the flight recording file (\f[V].jfr\f[R]).
.PP
Flight recording information is written in chunks.
A chunk contains all of the information necessary for parsing.
A chunk typically contains events useful for troubleshooting.
If a JVM should crash, these chunks can be recovered and used to create
a flight recording file using this \f[V]jfr assemble\f[R] command.
These chunk files are concatenated in chronological order and chunk
files that are not finished (.part) are excluded.
.SS \f[V]jfr disassemble\f[R] subcommand
.PP
Use \f[V]jfr disassemble\f[R] to decompose a flight recording file into
its chunk file pieces.
.PP
The syntax is:
.PP
\f[V]jfr disassemble\f[R] [\f[V]--max-chunks\f[R] <\f[I]chunks\f[R]>]
[\f[V]--output\f[R] <\f[I]directory\f[R]>] <\f[I]file\f[R]>
.PP
where:
.TP
\f[V]--output\f[R] <\f[I]directory\f[R]>
The location to write the disassembled file, by default the current
directory
.TP
\f[V]--max-chunks\f[R] <\f[I]chunks\f[R]>
Maximum number of chunks per file, by default 5.
The chunk size varies, but is typically around 15 MB.
.TP
\f[V]--max-size\f[R] <\f[I]size\f[R]>
Maximum number of bytes per file.
.TP
<\f[I]file\f[R]>
Location of the flight recording file (\f[V].jfr\f[R])
.PP
This function can be useful for repairing a broken file by removing the
faulty chunk.
It can also be used to reduce the size of a file that is too large to
transfer.
The resulting chunk files are named \f[V]myfile_1.jfr\f[R],
\f[V]myfile_2.jfr\f[R], etc.
If needed, the resulting file names will be padded with zeros to
preserve chronological order.
For example, the chunk file name is \f[V]myfile_001.jfr\f[R] if the
recording consists of more than 100 chunks.
.SS jfr version and help subcommands
.PP
Use \f[V]jfr --version\f[R] or \f[V]jfr version\f[R] to view the version
string information for this jfr command.
.PP
To get help on any of the jfr subcommands, use:
.PP
\f[V]jfr <--help|help>\f[R] [\f[I]subcommand\f[R]]
.PP
where:
.PP
[\f[I]subcommand\f[R]] is any of:
.IP \[bu] 2
\f[V]print\f[R]
.IP \[bu] 2
\f[V]view\f[R]
.IP \[bu] 2
\f[V]configure\f[R]
.IP \[bu] 2
\f[V]metadata\f[R]
.IP \[bu] 2
\f[V]summary\f[R]
.IP \[bu] 2
\f[V]scrub\f[R]
.IP \[bu] 2
\f[V]assemble\f[R]
.IP \[bu] 2
\f[V]disassemble\f[R]

View File

@ -0,0 +1,399 @@
---
# Copyright (c) 2019, 2023, 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.
#
title: 'JFR(1) JDK @@VERSION_SHORT@@ | JDK Commands'
date: @@COPYRIGHT_YEAR@@
lang: en
---
## Name
jfr - print and manipulate Flight Recorder files
## Synopsis
To print the contents of a flight recording to standard out:
`jfr` `print` \[*options*\] *file*
To display aggregated event data on standard out:
`jfr` `view` \[*options*\] *file*
To configure a .jfc settings file:
`jfr` `configure` \[*options*\]
To print metadata information about flight recording events:
`jfr` `metadata` \[*file*\]
To view the summary statistics for a flight recording file:
`jfr` `summary` *file*
To remove events from a flight recording file:
`jfr` `scrub` \[*options*\] *file*
To assemble chunk files into a flight recording file:
`jfr` `assemble` *repository* *file*
To disassemble a flight recording file into chunk files:
`jfr` `disassmble` \[*options*\] *file*
*options*
: Optional: Specifies command-line options separated by spaces. See the
individual subcomponent sections for descriptions of the available options.
*file*
: Specifies the name of the target flight recording file (`.jfr`).
*repository*
: Specifies the location of the chunk files which are to be assembled into
a flight recording.
## Description
The `jfr` command provides a tool for interacting with flight recorder files
(`.jfr`). The main function is to filter, summarize and output flight
recording files into human readable format. There is also support for scrubbing,
merging and splitting recording files.
Flight recording files are created and saved as binary formatted files. Having
a tool that can extract the contents from a flight recording and manipulate the
contents and translate them into human readable format helps developers to debug
performance issues with Java applications.
### Subcommands
The `jfr` command has several subcommands:
- `print`
- `view`
- `configure`
- `metadata`
- `summary`
- `scrub`
- `assemble`
- `disassemble`
#### `jfr print` subcommand
Use `jfr print` to print the contents of a flight recording file to standard out.
The syntax is:
`jfr print` \[`--xml`|`--json`\]
\[`--categories` <*filters*>\]
\[`--events` <*filters*>\]
\[`--stack-depth` <*depth*>\]
<*file*>
where:
<a id="print-option-xml">`--xml`</a>
: Print the recording in XML format.
<a id="print-option-json">`--json`</a>
: Print the recording in JSON format.
<a id="print-option-categories">`--categories` <*filters*></a>
: Select events matching a category name.
The filter is a comma-separated list of names,
simple and/or qualified, and/or quoted glob patterns.
<a id="print-option-events">`--events` <*filters*></a>
: Select events matching an event name.
The filter is a comma-separated list of names,
simple and/or qualified, and/or quoted glob patterns.
<a id="print-option-stack-depth">`--stack-depth` <*depth*></a>
: Number of frames in stack traces, by default 5.
<a id="print-option-file"><*file*></a>
: Location of the recording file (`.jfr`)
The default format for printing the contents of the flight recording file is human
readable form unless either `xml` or `json` is specified. These options provide
machine-readable output that can be further parsed or processed by user created scripts.
Use `jfr --help print` to see example usage of filters.
To reduce the amount of data displayed, it is possible to filter out events or
categories of events. The filter operates on the symbolic name of an event,
set by using the `@Name` annotation, or the category name, set by using
the `@Category` annotation. If multiple filters are used, events from both
filters will be included. If no filter is used, all the events will be printed.
If a combination of a category filter and event filter is used, the selected events
will be the union of the two filters.
For example, to show all GC events and the CPULoad event, the following command could be used:
`jfr print --categories GC --events CPULoad recording.jfr`
Event values are formatted according to the content types that are being used.
For example, a field with the `jdk.jfr.Percentage` annotation that has the value 0.52
is formatted as 52%.
Stack traces are by default truncated to 5 frames, but the number can be
increased/decreased using the `--stack-depth` command-line option.
#### `jfr view` subcommand
Use `jfr view` to aggregate and display event data on standard out.
The syntax is:
`jfr view` \[`--verbose`\]
\[`--width` <*integer*>\]
\[`--truncate` <*mode*>\]
\[`--cell-height` <*integer*>\]
<*view*>
<*file*>
where:
<a id="view-option-verbose">`--verbose`</a>
: Displays the query that makes up the view.
<a id="view-option-width">`--width` <*integer*></a>
: The width of the view in characters. Default value depends on the view.
<a id="view-option-truncate">`--truncate` <*mode*></a>
: How to truncate content that exceeds space in a table cell.
Mode can be 'beginning' or 'end'. Default value is 'end'.
<a id="view-option-cell-height">`--cell-height` <*integer*></a>
: Maximum number of rows in a table cell. Default value depends on the view.
<a id="view-option-view"><*view*></a>
: Name of the view or event type to display. Use `jfr --help view` to see a
list of available views.
<a id="view-option-file"><*file*></a>
: Location of the recording file (.jfr)
The <*view*> parameter can be an event type name. Use the `jfr view types <file>`
to see a list. To display all views, use `jfr view all-views <file>`. To display
all events, use `jfr view all-events <file>`.
#### `jfr configure` subcommand
Use `jfr configure` to configure a .jfc settings file.
The syntax is:
`jfr configure` \[--interactive\] \[--verbose\]
\[--input <files>\] [--output <file>\]
\[option=value\]* \[event-setting=value\]*
<a id="configure-option-interactive">`--interactive`</a>
: Interactive mode where the configuration is determined by a set of questions.
<a id="configure-option-verbose">`--verbose`</a>
: Displays the modified settings.
<a id="configure-option-input">`--input` <*files*></a>
: A comma-separated list of .jfc files from which the new configuration is
based. If no file is specified, the default file in the JDK is used
(default.jfc). If 'none' is specified, the new configuration starts empty.
<a id="configure-option-output">`--output` <*file*></a>
: The filename of the generated output file. If not specified, the filename
custom.jfc will be used.
<a id="configure-option-value">*option=value*</a>
: The option value to modify. To see available options,
use `jfr help configure`
<a id="configure-option-event-setting">*event-setting=value*</a>
: The event setting value to modify. Use the form:
<*event-name*>#<*setting-name*>=<*value*>
To add a new event setting, prefix the event name with '+'.
The whitespace delimiter can be omitted for timespan values, i.e. 20ms. For
more information about the settings syntax, see Javadoc of the jdk.jfr package.
#### `jfr metadata` subcommand
Use `jfr metadata` to display information about events, such as event
names, categories and field layout within a flight recording file.
The syntax is:
`jfr metadata` \[--categories <filter>\]
\[--events <filter>\]
\[<file>\]
<a id="metadata-option-categories">`--categories` <*filter*></a>
: Select events matching a category name. The filter is a comma-separated
list of names, simple and/or qualified, and/or quoted glob patterns.
<a id="metadata-option-events">`--events` <*filter*></a>
: Select events matching an event name. The filter is a comma-separated
list of names, simple and/or qualified, and/or quoted glob patterns.
<a id="metadata-option-file"><*file*></a>
: Location of the recording file (.jfr)
If the <file> parameter is omitted, metadata from the JDK where
the 'jfr' tool is located will be used.
#### `jfr summary` subcommand
Use `jfr summary` to print statistics for a recording. For example, a summary can
illustrate the number of recorded events and how much disk space they used. This
is useful for troubleshooting and understanding the impact of event settings.
The syntax is:
`jfr summary` <*file*>
where:
<a id="summary-option-file"><*file*></a>
: Location of the flight recording file (`.jfr`)
#### `jfr scrub` subcommand
Use `jfr scrub` to remove sensitive contents from a file or to reduce its size.
The syntax is:
`jfr scrub` \[--include-events <*filter*>\]
\[--exclude-events <*filter*>\]
\[--include-categories <*filter*>\]
\[--exclude-categories <*filter*>\]
\[--include-threads <*filter*>\]
\[--exclude-threads <*filter*>\]
<*input-file*>
\[<*output-file*>\]
<a id="scrub-option-include-events">`--include-events` <*filter*></a>
: Select events matching an event name.
<a id="scrub-option-exclude-events">`--exclude-events` <*filter*></a>
: Exclude events matching an event name.
<a id="scrub-option-include-categories">`--include-categories` <*filter*></a>
: Select events matching a category name.
<a id="scrub-option-exclude-categories">`--exclude-categories` <*filter*></a>
: Exclude events matching a category name.
<a id="scrub-option-include-threads">`--include-threads` <*filter*></a>
: Select events matching a thread name.
<a id="scrub-option-exclude-threads">`--exclude-threads` <*filter*></a>
: Exclude events matching a thread name.
<a id="scrub-option-input-file"><*input-file*></a>
: The input file to read events from.
<a id="scrub-option-output-file"><*output-file*></a>
: The output file to write filter events to. If no file is specified,
it will be written to the same path as the input file, but with
"-scrubbed" appended to the filename.
The filter is a comma-separated list of names, simple and/or qualified,
and/or quoted glob patterns. If multiple filters are used, they
are applied in the specified order.
#### `jfr assemble` subcommand
Use jfr `assemble` to assemble chunk files into a recording file.
The syntax is:
`jfr assemble` <*repository*>
<*file*>
where:
<a id="assemble-option-repository"><*repository*></a>
: Directory where the repository containing chunk files is located.
<a id="assemble-option-file"><*file*></a>
: Location of the flight recording file (`.jfr`).
Flight recording information is written in chunks. A chunk contains all of the information
necessary for parsing. A chunk typically contains events useful for troubleshooting.
If a JVM should crash, these chunks can be recovered and used to create a flight
recording file using this `jfr assemble` command. These chunk files are concatenated in
chronological order and chunk files that are not finished (.part) are excluded.
#### `jfr disassemble` subcommand
Use `jfr disassemble` to decompose a flight recording file into its chunk file pieces.
The syntax is:
`jfr disassemble` \[`--max-chunks` <*chunks*>\]
\[`--output` <*directory*>\]
<*file*>
where:
<a id="disassemble-option-output">`--output` <*directory*></a>
: The location to write the disassembled file,
by default the current directory
<a id="disassemble-option-max-chunks">`--max-chunks` <*chunks*></a>
: Maximum number of chunks per file, by default 5.
The chunk size varies, but is typically around 15 MB.
<a id="disassemble-option-max-size">`--max-size` <*size*></a>
: Maximum number of bytes per file.
<a id="disassemble-option-file"><*file*></a>
: Location of the flight recording file (`.jfr`)
This function can be useful for repairing a broken file by removing the faulty chunk.
It can also be used to reduce the size of a file that is too large to transfer.
The resulting chunk files are named `myfile_1.jfr`, `myfile_2.jfr`, etc. If needed, the
resulting file names will be padded with zeros to preserve chronological order. For example,
the chunk file name is `myfile_001.jfr` if the recording consists of more than 100 chunks.
#### jfr version and help subcommands
Use `jfr --version` or `jfr version` to view the version string information for this jfr command.
To get help on any of the jfr subcommands, use:
`jfr <--help|help>` \[*subcommand*\]
where:
\[*subcommand*\] is any of:
- `print`
- `view`
- `configure`
- `metadata`
- `summary`
- `scrub`
- `assemble`
- `disassemble`

View File

@ -1,409 +0,0 @@
.\" Copyright (c) 2017, 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.19.2
.\"
.\" Define V font for inline verbatim, using C font in formats
.\" that render this, and otherwise B font.
.ie "\f[CB]x\f[R]"x" \{\
. ftr V B
. ftr VI BI
. ftr VB B
. ftr VBI BI
.\}
.el \{\
. ftr V CR
. ftr VI CI
. ftr VB CB
. ftr VBI CBI
.\}
.TH "JLINK" "1" "2025" "JDK 24-ea" "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[V]jlink\f[R] [\f[I]options\f[R]] \f[V]--module-path\f[R]
\f[I]modulepath\f[R] \f[V]--add-modules\f[R]
\f[I]module\f[R][,\f[I]module\f[R]...]
.TP
\f[I]options\f[R]
Command-line options separated by spaces.
See \f[B]jlink Options\f[R].
.TP
\f[I]modulepath\f[R]
The path where the \f[V]jlink\f[R] tool discovers observable modules.
These modules can be modular JAR files, JMOD files, or exploded modules.
.TP
\f[I]module\f[R]
The names of the modules to add to the runtime image.
The \f[V]jlink\f[R] tool adds these modules and their transitive
dependencies.
.SH DESCRIPTION
.PP
The \f[V]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
\f[V]--add-modules\f[R] \f[I]mod\f[R][\f[V],\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.
.TP
\f[V]--bind-services\f[R]
Link service provider modules and their dependencies.
.TP
\f[V]-c ={0|1|2}\f[R] or \f[V]--compress={0|1|2}\f[R]
Enable compression of resources:
.RS
.IP \[bu] 2
\f[V]0\f[R]: No compression
.IP \[bu] 2
\f[V]1\f[R]: Constant string sharing
.IP \[bu] 2
\f[V]2\f[R]: ZIP
.RE
.TP
\f[V]--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.
.TP
\f[V]--endian\f[R] {\f[V]little\f[R]|\f[V]big\f[R]}
Specifies the byte order of the generated image.
The default value is the format of your system\[aq]s architecture.
.TP
\f[V]-h\f[R] or \f[V]--help\f[R]
Prints the help message.
.TP
\f[V]--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.
.TP
\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]
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[V]/\f[R])).
.TP
\f[V]--limit-modules\f[R] \f[I]mod\f[R][\f[V],\f[R]\f[I]mod\f[R]...]
Limits the universe of observable modules to those in the transitive
closure of the named modules, \f[V]mod\f[R], plus the main module, if
any, plus any further modules specified in the \f[V]--add-modules\f[R]
option.
.TP
\f[V]--list-plugins\f[R]
Lists available plug-ins, which you can access through command-line
options; see \f[B]jlink Plug-ins\f[R].
.TP
\f[V]-p\f[R] or \f[V]--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[V]$JAVA_HOME/jmods\f[R].
This directory contains the \f[V]java.base\f[R] module and the other
standard and JDK modules.
If this option is specified but the \f[V]java.base\f[R] module cannot be
resolved from it, then the \f[V]jlink\f[R] command appends
\f[V]$JAVA_HOME/jmods\f[R] to the module path.
.RE
.TP
\f[V]--no-header-files\f[R]
Excludes header files.
.TP
\f[V]--no-man-pages\f[R]
Excludes man pages.
.TP
\f[V]--output\f[R] \f[I]path\f[R]
Specifies the location of the generated runtime image.
.TP
\f[V]--save-opts\f[R] \f[I]filename\f[R]
Saves \f[V]jlink\f[R] options in the specified file.
.TP
\f[V]--suggest-providers\f[R] [\f[I]name\f[R]\f[V],\f[R] ...]
Suggest providers that implement the given service types from the module
path.
.TP
\f[V]--version\f[R]
Prints version information.
.TP
\f[V]\[at]\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[V]#\f[R]) to
the beginning of the line.
.PP
The following is an example of an options file for the \f[V]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[V]glob:\f[R]\f[I]glob-pattern\f[R]
.IP \[bu] 2
\f[V]regex:\f[R]\f[I]regex-pattern\f[R]
.IP \[bu] 2
\f[V]\[at]\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[V]jlink --list-plugins\f[R].
.SS Plugin \f[V]compress\f[R]
.TP
Options
\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]]
.TP
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[V]include-locales\f[R]
.TP
Options
\f[V]--include-locales=\f[R]\f[I]langtag\f[R][\f[V],\f[R]\f[I]langtag\f[R]]*
.TP
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[V]--add-modules jdk.localedata --include-locales=en,ja,*-IN\f[R]
.RE
.RE
.SS Plugin \f[V]order-resources\f[R]
.TP
Options
\f[V]--order-resources=\f[R]\f[I]pattern-list\f[R]
.TP
Description
Orders the specified paths in priority order.
If \f[V]\[at]\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[V]--order-resources=/module-info.class,\[at]classlist,/java.base/java/lang/\f[R]
.RE
.RE
.SS Plugin \f[V]strip-debug\f[R]
.TP
Options
\f[V]--strip-debug\f[R]
.TP
Description
Strips debug information from the output image.
.SS Plugin \f[V]generate-cds-archive\f[R]
.TP
Options
\f[V]--generate-cds-archive\f[R]
.TP
Description
Generate CDS archive if the runtime image supports the CDS feature.
.SH JLINK EXAMPLES
.PP
The following command creates a runtime image in the directory
\f[V]greetingsapp\f[R].
This command links the module \f[V]com.greetings\f[R], whose module
definition is contained in the directory \f[V]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[V]greetingsapp\f[R]:
.IP
.nf
\f[CB]
greetingsapp/bin/java --list-modules
com.greetings
java.base\[at]11
java.logging\[at]11
org.astro\[at]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[V]compressedrt\f[R] with \f[V]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[V]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[V]mybuild\f[R] that includes only \f[V]java.naming\f[R] and
\f[V]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
The following command is similar to the one that creates a runtime image
named \f[V]greetingsapp\f[R], except that it will link the modules
resolved from root modules with service binding; see the
\f[B]\f[VB]Configuration.resolveAndBind\f[B]\f[R] method.
.IP
.nf
\f[CB]
jlink --module-path mlib --add-modules com.greetings --output greetingsapp --bind-services
\f[R]
.fi
.PP
The following command lists the modules in the runtime image
greetingsapp created by this command:
.IP
.nf
\f[CB]
greetingsapp/bin/java --list-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
\f[R]
.fi

View File

@ -0,0 +1,347 @@
---
# Copyright (c) 2017, 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.
#
title: 'JLINK(1) JDK @@VERSION_SHORT@@ | JDK Commands'
date: @@COPYRIGHT_YEAR@@
lang: en
---
## Name
jlink - assemble and optimize a set of modules and their dependencies into a
custom runtime image
## Synopsis
`jlink` \[*options*\] `--module-path` *modulepath* `--add-modules` *module*\[,*module*...\]
*options*
: Command-line options separated by spaces. See [jlink Options].
*modulepath*
: The path where the `jlink` tool discovers observable modules. These modules
can be modular JAR files, JMOD files, or exploded modules.
*module*
: The names of the modules to add to the runtime image. The `jlink` tool adds
these modules and their transitive dependencies.
## Description
The `jlink` tool links a set of modules, along with their transitive
dependences, to create a custom runtime image.
**Note:**
Developers are responsible for updating their custom runtime images.
## jlink Options
`--add-modules` *mod*\[`,`*mod*...\]
: Adds the named modules, *mod*, to the default set of root modules. The
default set of root modules is empty.
`--bind-services`
: Link service provider modules and their dependencies.
`-c ={0|1|2}` or `--compress={0|1|2}`
: Enable compression of resources:
- `0`: No compression
- `1`: Constant string sharing
- `2`: ZIP
`--disable-plugin` *pluginname*
: Disables the specified plug-in. See [jlink Plug-ins] for the list of
supported plug-ins.
`--endian` {`little`\|`big`}
: Specifies the byte order of the generated image. The default value is the
format of your system's architecture.
`-h` or `--help`
: Prints the help message.
`--ignore-signing-information`
: Suppresses a fatal error when signed modular JARs are linked in the runtime
image. The signature-related files of the signed modular JARs aren't copied
to the runtime image.
`--launcher` *command*`=`*module* or `--launcher` *command*`=`*module*`/`*main*
: 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 (`/`)).
`--limit-modules` *mod*\[`,`*mod*...\]
: Limits the universe of observable modules to those in the transitive
closure of the named modules, `mod`, plus the main module, if any, plus any
further modules specified in the `--add-modules` option.
`--list-plugins`
: Lists available plug-ins, which you can access through command-line
options; see [jlink Plug-ins].
`-p` or `--module-path` *modulepath*
: Specifies the module path.
If this option is not specified, then the default module path is
`$JAVA_HOME/jmods`. This directory contains the `java.base` module and the
other standard and JDK modules. If this option is specified but the
`java.base` module cannot be resolved from it, then the `jlink` command
appends `$JAVA_HOME/jmods` to the module path.
`--no-header-files`
: Excludes header files.
`--no-man-pages`
: Excludes man pages.
`--output` *path*
: Specifies the location of the generated runtime image.
`--save-opts` *filename*
: Saves `jlink` options in the specified file.
`--suggest-providers` \[*name*`,` ...\]
: Suggest providers that implement the given service types from the module
path.
`--version`
: Prints version information.
`@`*filename*
: 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 (`#`) to
the beginning of the line.
The following is an example of an options file for the `jlink` command:
```
#Wed Dec 07 00:40:19 EST 2016
--module-path mlib
--add-modules com.greetings
--output greetingsapp
```
## jlink Plug-ins
**Note:**
Plug-ins not listed in this section aren't supported and are subject to change.
For plug-in options that require a *pattern-list*, the value is a
comma-separated list of elements, with each element using one the following
forms:
- *glob-pattern*
- `glob:`*glob-pattern*
- `regex:`*regex-pattern*
- `@`*filename*
- *filename* is the name of a file that contains patterns to be used, one
pattern per line.
For a complete list of all available plug-ins, run the command
`jlink --list-plugins`.
### Plugin `compress`
Options
: `--compress=`{`0`\|`1`\|`2`}\[`:filter=`*pattern-list*\]
Description
: Compresses all resources in the output image.
- Level 0: No compression
- Level 1: Constant string sharing
- Level 2: ZIP
An optional *pattern-list* filter can be specified to list the pattern of
files to include.
### Plugin `include-locales`
Options
: `--include-locales=`*langtag*\[`,`*langtag*\]\*
Description
: Includes the list of locales where *langtag* 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:
> `--add-modules jdk.localedata --include-locales=en,ja,*-IN`
### Plugin `order-resources`
Options
: `--order-resources=`*pattern-list*
Description
: Orders the specified paths in priority order. If `@`*filename* is
specified, then each line in *pattern-list* must be an exact match for the
paths to be ordered.
Example:
> `--order-resources=/module-info.class,@classlist,/java.base/java/lang/`
### Plugin `strip-debug`
Options
: `--strip-debug`
Description
: Strips debug information from the output image.
### Plugin `generate-cds-archive`
Options
: `--generate-cds-archive`
Description
: Generate CDS archive if the runtime image supports the CDS feature.
## jlink Examples
The following command creates a runtime image in the directory `greetingsapp`.
This command links the module `com.greetings`, whose module definition is
contained in the directory `mlib`.
```
jlink --module-path mlib --add-modules com.greetings --output greetingsapp
```
The following command lists the modules in the runtime image `greetingsapp`:
```
greetingsapp/bin/java --list-modules
com.greetings
java.base@11
java.logging@11
org.astro@1.0
```
The following command creates a runtime image in the directory compressedrt
that's stripped of debug symbols, uses compression to reduce space, and
includes French language locale information:
```
jlink --add-modules jdk.localedata --strip-debug --compress=2 --include-locales=fr --output compressedrt
```
The following example compares the size of the runtime image `compressedrt`
with `fr_rt`, which isn't stripped of debug symbols and doesn't use
compression:
```
jlink --add-modules jdk.localedata --include-locales=fr --output fr_rt
du -sh ./compressedrt ./fr_rt
23M ./compressedrt
36M ./fr_rt
```
The following example lists the providers that implement
`java.security.Provider`:
```
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
```
The following example creates a custom runtime image named `mybuild` that
includes only `java.naming` and `jdk.crypto.cryptoki` and their dependencies but no
other providers. Note that these dependencies must exist in the module path:
```
jlink --add-modules java.naming,jdk.crypto.cryptoki --output mybuild
```
The following command is similar to the one that creates a runtime image named
`greetingsapp`, except that it will link the modules resolved from root modules
with service binding; see the [`Configuration.resolveAndBind`](
../../api/java.base/java/lang/module/Configuration.html#resolveAndBind(java.lang.module.ModuleFinder,java.util.List,java.lang.module.ModuleFinder,java.util.Collection))
method.
```
jlink --module-path mlib --add-modules com.greetings --output greetingsapp --bind-services
```
The following command lists the modules in the runtime image greetingsapp
created by this command:
```
greetingsapp/bin/java --list-modules
com.greetings
java.base@11
java.compiler@11
java.datatransfer@11
java.desktop@11
java.logging@11
java.management@11
java.management.rmi@11
java.naming@11
java.prefs@11
java.rmi@11
java.security.jgss@11
java.security.sasl@11
java.smartcardio@11
java.xml@11
java.xml.crypto@11
jdk.accessibility@11
jdk.charsets@11
jdk.compiler@11
jdk.crypto.cryptoki@11
jdk.crypto.ec@11
jdk.crypto.mscapi@11
jdk.internal.opt@11
jdk.jartool@11
jdk.javadoc@11
jdk.jdeps@11
jdk.jfr@11
jdk.jlink@11
jdk.localedata@11
jdk.management@11
jdk.management.jfr@11
jdk.naming.dns@11
jdk.naming.rmi@11
jdk.security.auth@11
jdk.security.jgss@11
jdk.zipfs@11
org.astro@1.0
```

View File

@ -1,423 +0,0 @@
.\" Copyright (c) 2017, 2023, 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.19.2
.\"
.\" Define V font for inline verbatim, using C font in formats
.\" that render this, and otherwise B font.
.ie "\f[CB]x\f[R]"x" \{\
. ftr V B
. ftr VI BI
. ftr VB B
. ftr VBI BI
.\}
.el \{\
. ftr V CR
. ftr VI CI
. ftr VB CB
. ftr VBI CBI
.\}
.TH "JMOD" "1" "2025" "JDK 24-ea" "JDK Commands"
.hy
.SH NAME
.PP
jmod - create JMOD files and list the content of existing JMOD files
.SH SYNOPSIS
.PP
\f[V]jmod\f[R]
(\f[V]create\f[R]|\f[V]extract\f[R]|\f[V]list\f[R]|\f[V]describe\f[R]|\f[V]hash\f[R])
[\f[I]options\f[R]] \f[I]jmod-file\f[R]
.PP
Includes the following:
.PP
\f[B]Main operation modes\f[R]
.TP
\f[V]create\f[R]
Creates a new JMOD archive file.
.TP
\f[V]extract\f[R]
Extracts all the files from the JMOD archive file.
.TP
\f[V]list\f[R]
Prints the names of all the entries.
.TP
\f[V]describe\f[R]
Prints the module details.
.TP
\f[V]hash\f[R]
Determines leaf modules and records the hashes of the dependencies that
directly and indirectly require them.
.PP
\f[B]Options\f[R]
.TP
\f[I]options\f[R]
See \f[B]Options for jmod\f[R].
.PP
\f[B]Required\f[R]
.TP
\f[I]jmod-file\f[R]
Specifies the name of the JMOD file to create or from which to retrieve
information.
.SH DESCRIPTION
.PP
\f[B]Note:\f[R] For most development tasks, including deploying modules
on the module path or publishing them to a Maven repository, continue to
package modules in modular JAR files.
The \f[V]jmod\f[R] tool is intended for modules that have native
libraries or other configuration files or for modules that you intend to
link, with the \f[B]jlink\f[R] tool, to a runtime image.
.PP
The JMOD file format lets you aggregate files other than
\f[V].class\f[R] files, metadata, and resources.
This format is transportable but not executable, which means that you
can use it during compile time or link time but not at run time.
.PP
Many \f[V]jmod\f[R] options involve specifying a path whose contents are
copied into the resulting JMOD files.
These options copy all the contents of the specified path, including
subdirectories and their contents, but exclude files whose names match
the pattern specified by the \f[V]--exclude\f[R] option.
.PP
With the \f[V]--hash-modules\f[R] option or the \f[V]jmod hash\f[R]
command, you can, in each module\[aq]s descriptor, record hashes of the
content of the modules that are allowed to depend upon it, thus
\[dq]tying\[dq] together these modules.
This enables a package to be exported to one or more specifically-named
modules and to no others through qualified exports.
The runtime verifies if the recorded hash of a module matches the one
resolved at run time; if not, the runtime returns an error.
.SH OPTIONS FOR JMOD
.TP
\f[V]--class-path\f[R] \f[I]path\f[R]
Specifies the location of application JAR files or a directory
containing classes to copy into the resulting JMOD file.
.TP
\f[V]--cmds\f[R] \f[I]path\f[R]
Specifies the location of native commands to copy into the resulting
JMOD file.
.TP
\f[V]--compress\f[R] \f[I]compress\f[R]
Specifies the compression to use in creating the JMOD file.
The accepted values are \f[V]zip-[0-9]\f[R], where \f[V]zip-0\f[R]
provides no compression, and \f[V]zip-9\f[R] provides the best
compression.
Default is \f[V]zip-6\f[R].
.TP
\f[V]--config\f[R] \f[I]path\f[R]
Specifies the location of user-editable configuration files to copy into
the resulting JMOD file.
.TP
\f[V]--date\f[R]\f[I]TIMESTAMP\f[R]
The timestamp in ISO-8601 extended offset date-time with optional
time-zone format, to use for the timestamp of the entries, e.g.
\[dq]2022-02-12T12:30:00-05:00\[dq].
.TP
\f[V]--dir\f[R] \f[I]path\f[R]
Specifies the location where \f[V]jmod\f[R] puts extracted files from
the specified JMOD archive.
.TP
\f[V]--dry-run\f[R]
Performs a dry run of hash mode.
It identifies leaf modules and their required modules without recording
any hash values.
.TP
\f[V]--exclude\f[R] \f[I]pattern-list\f[R]
Excludes files matching the supplied comma-separated pattern list, each
element using one the following forms:
.RS
.IP \[bu] 2
\f[I]glob-pattern\f[R]
.IP \[bu] 2
\f[V]glob:\f[R]\f[I]glob-pattern\f[R]
.IP \[bu] 2
\f[V]regex:\f[R]\f[I]regex-pattern\f[R]
.PP
See the \f[B]\f[VB]FileSystem.getPathMatcher\f[B]\f[R] method for the
syntax of \f[I]glob-pattern\f[R].
See the \f[B]\f[VB]Pattern\f[B]\f[R] class for the syntax of
\f[I]regex-pattern\f[R], which represents a regular expression.
.RE
.TP
\f[V]--hash-modules\f[R] \f[I]regex-pattern\f[R]
Determines the leaf modules and records the hashes of the dependencies
directly and indirectly requiring them, based on the module graph of the
modules matching the given \f[I]regex-pattern\f[R].
The hashes are recorded in the JMOD archive file being created, or a
JMOD archive or modular JAR on the module path specified by the
\f[V]jmod hash\f[R] command.
.TP
\f[V]--header-files\f[R] \f[I]path\f[R]
Specifies the location of header files to copy into the resulting JMOD
file.
.TP
\f[V]--help\f[R] or \f[V]-h\f[R]
Prints a usage message.
.TP
\f[V]--help-extra\f[R]
Prints help for extra options.
.TP
\f[V]--legal-notices\f[R] \f[I]path\f[R]
Specifies the location of legal notices to copy into the resulting JMOD
file.
.TP
\f[V]--libs\f[R] \f[I]path\f[R]
Specifies location of native libraries to copy into the resulting JMOD
file.
.TP
\f[V]--main-class\f[R] \f[I]class-name\f[R]
Specifies main class to record in the module-info.class file.
.TP
\f[V]--man-pages\f[R] \f[I]path\f[R]
Specifies the location of man pages to copy into the resulting JMOD
file.
.TP
\f[V]--module-version\f[R] \f[I]module-version\f[R]
Specifies the module version to record in the module-info.class file.
.TP
\f[V]--module-path\f[R] \f[I]path\f[R] or \f[V]-p\f[R] \f[I]path\f[R]
Specifies the module path.
This option is required if you also specify \f[V]--hash-modules\f[R].
.TP
\f[V]--target-platform\f[R] \f[I]platform\f[R]
Specifies the target platform.
.TP
\f[V]--version\f[R]
Prints version information of the \f[V]jmod\f[R] tool.
.TP
\f[V]\[at]\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 ordinarily 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 prefixinga hash symbol (\f[V]#\f[R]) to the
beginning of the line.
.PP
The following is an example of an options file for the \f[V]jmod\f[R]
command:
.IP
.nf
\f[CB]
#Wed Dec 07 00:40:19 EST 2016
create --class-path mods/com.greetings --module-path mlib
--cmds commands --config configfiles --header-files src/h
--libs lib --main-class com.greetings.Main
--man-pages man --module-version 1.0
--os-arch \[dq]x86_x64\[dq] --os-name \[dq]macOS\[dq]
--os-version \[dq]10.10.5\[dq] greetingsmod
\f[R]
.fi
.RE
.SH EXTRA OPTIONS FOR JMOD
.PP
In addition to the options described in \f[B]Options for jmod\f[R], the
following are extra options that can be used with the command.
.TP
\f[V]--do-not-resolve-by-default\f[R]
Exclude from the default root set of modules
.TP
\f[V]--warn-if-resolved\f[R]
Hint for a tool to issue a warning if the module is resolved.
One of deprecated, deprecated-for-removal, or incubating.
.SH JMOD CREATE EXAMPLE
.PP
The following is an example of creating a JMOD file:
.IP
.nf
\f[CB]
jmod create --class-path mods/com.greetings --cmds commands
--config configfiles --header-files src/h --libs lib
--main-class com.greetings.Main --man-pages man --module-version 1.0
--os-arch \[dq]x86_x64\[dq] --os-name \[dq]macOS\[dq]
--os-version \[dq]10.10.5\[dq] greetingsmod
\f[R]
.fi
.PP
Create a JMOD file specifying the date for the entries as
\f[V]2022 March 15 00:00:00\f[R]:
.IP
.nf
\f[CB]
jmod create --class-path build/foo/classes --date 2022-03-15T00:00:00Z
jmods/foo1.jmod
\f[R]
.fi
.SH JMOD HASH EXAMPLE
.PP
The following example demonstrates what happens when you try to link a
leaf module (in this example, \f[V]ma\f[R]) with a required module
(\f[V]mb\f[R]), and the hash value recorded in the required module
doesn\[aq]t match that of the leaf module.
.IP "1." 3
Create and compile the following \f[V].java\f[R] files:
.RS 4
.IP \[bu] 2
\f[V]jmodhashex/src/ma/module-info.java\f[R]
.RS 2
.IP
.nf
\f[CB]
module ma {
requires mb;
}
\f[R]
.fi
.RE
.IP \[bu] 2
\f[V]jmodhashex/src/mb/module-info.java\f[R]
.RS 2
.IP
.nf
\f[CB]
module mb {
}
\f[R]
.fi
.RE
.IP \[bu] 2
\f[V]jmodhashex2/src/ma/module-info.java\f[R]
.RS 2
.IP
.nf
\f[CB]
module ma {
requires mb;
}
\f[R]
.fi
.RE
.IP \[bu] 2
\f[V]jmodhashex2/src/mb/module-info.java\f[R]
.RS 2
.IP
.nf
\f[CB]
module mb {
}
\f[R]
.fi
.RE
.RE
.IP "2." 3
Create a JMOD archive for each module.
Create the directories \f[V]jmodhashex/jmods\f[R] and
\f[V]jmodhashex2/jmods\f[R], and then run the following commands from
the \f[V]jmodhashex\f[R] directory, then from the \f[V]jmodhashex2\f[R]
directory:
.RS 4
.IP \[bu] 2
\f[V]jmod create --class-path mods/ma jmods/ma.jmod\f[R]
.IP \[bu] 2
\f[V]jmod create --class-path mods/mb jmods/mb.jmod\f[R]
.RE
.IP "3." 3
Optionally preview the \f[V]jmod hash\f[R] command.
Run the following command from the \f[V]jmodhashex\f[R] directory:
.RS 4
.PP
\f[V]jmod hash --dry-run -module-path jmods --hash-modules .*\f[R]
.PP
The command prints the following:
.IP
.nf
\f[CB]
Dry run:
mb
hashes ma SHA-256 07667d5032004b37b42ec2bb81b46df380cf29e66962a16481ace2e71e74073a
\f[R]
.fi
.PP
This indicates that the \f[V]jmod hash\f[R] command (without the
\f[V]--dry-run\f[R] option) will record the hash value of the leaf
module \f[V]ma\f[R] in the module \f[V]mb\f[R].
.RE
.IP "4." 3
Record hash values in the JMOD archive files contained in the
\f[V]jmodhashex\f[R] directory.
Run the following command from the \f[V]jmodhashex\f[R] directory:
.RS 4
.RS
.PP
\f[V]jmod hash --module-path jmods --hash-modules .*\f[R]
.RE
.PP
The command prints the following:
.RS
.PP
\f[V]Hashes are recorded in module mb\f[R]
.RE
.RE
.IP "5." 3
Print information about each JMOD archive contained in the
\f[V]jmodhashex\f[R] directory.
Run the highlighted commands from the \f[V]jmodhashex\f[R] directory:
.RS 4
.IP
.nf
\f[CB]
jmod describe jmods/ma.jmod
ma
requires mandated java.base
requires mb
jmod describe jmods/mb.jmod
mb
requires mandated java.base
hashes ma SHA-256 07667d5032004b37b42ec2bb81b46df380cf29e66962a16481ace2e71e74073a
\f[R]
.fi
.RE
.IP "6." 3
Attempt to create a runtime image that contains the module \f[V]ma\f[R]
from the directory \f[V]jmodhashex2\f[R] but the module \f[V]mb\f[R]
from the directory \f[V]jmodhashex\f[R].
Run the following command from the \f[V]jmodhashex2\f[R] directory:
.RS 4
.IP \[bu] 2
\f[B]Linux and macOS:\f[R]
.RS 2
.RS
.PP
\f[V]jlink --module-path $JAVA_HOME/jmods:jmods/ma.jmod:../jmodhashex/jmods/mb.jmod --add-modules ma --output ma-app\f[R]
.RE
.RE
.IP \[bu] 2
\f[B]Windows:\f[R]
.RS 2
.RS
.PP
\f[V]jlink --module-path %JAVA_HOME%/jmods;jmods/ma.jmod;../jmodhashex/jmods/mb.jmod --add-modules ma --output ma-app\f[R]
.RE
.RE
.PP
The command prints an error message similar to the following:
.IP
.nf
\f[CB]
Error: Hash of ma (a2d77889b0cb067df02a3abc39b01ac1151966157a68dc4241562c60499150d2) differs to
expected hash (07667d5032004b37b42ec2bb81b46df380cf29e66962a16481ace2e71e74073a) recorded in mb
\f[R]
.fi
.RE

View File

@ -0,0 +1,348 @@
---
# Copyright (c) 2017, 2023, 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.
#
title: 'JMOD(1) JDK @@VERSION_SHORT@@ | JDK Commands'
date: @@COPYRIGHT_YEAR@@
lang: en
---
## Name
jmod - create JMOD files and list the content of existing JMOD files
## Synopsis
`jmod` (`create`\|`extract`\|`list`\|`describe`\|`hash`) \[*options*\]
*jmod-file*
Includes the following:
**Main operation modes**
`create`
: Creates a new JMOD archive file.
`extract`
: Extracts all the files from the JMOD archive file.
`list`
: Prints the names of all the entries.
`describe`
: Prints the module details.
`hash`
: Determines leaf modules and records the hashes of the dependencies that
directly and indirectly require them.
**Options**
*options*
: See [Options for jmod].
**Required**
*jmod-file*
: Specifies the name of the JMOD file to create or from which to retrieve
information.
## Description
**Note:** For most development tasks, including deploying modules on the module
path or publishing them to a Maven repository, continue to package modules in
modular JAR files. The `jmod` tool is intended for modules that have native
libraries or other configuration files or for modules that you intend to link,
with the [jlink](jlink.html) tool, to a runtime image.
The JMOD file format lets you aggregate files other than `.class` files,
metadata, and resources. This format is transportable but not executable, which
means that you can use it during compile time or link time but not at run time.
Many `jmod` options involve specifying a path whose contents are copied into
the resulting JMOD files. These options copy all the contents of the specified
path, including subdirectories and their contents, but exclude files whose
names match the pattern specified by the `--exclude` option.
With the `--hash-modules` option or the `jmod hash` command, you can, in each
module's descriptor, record hashes of the content of the modules that are
allowed to depend upon it, thus "tying" together these modules. This enables a
package to be exported to one or more specifically-named modules and to no
others through qualified exports. The runtime verifies if the recorded hash of
a module matches the one resolved at run time; if not, the runtime returns an
error.
## Options for jmod
`--class-path` *path*
: Specifies the location of application JAR files or a directory containing
classes to copy into the resulting JMOD file.
`--cmds` *path*
: Specifies the location of native commands to copy into the resulting JMOD
file.
`--compress` *compress*
: Specifies the compression to use in creating the JMOD file.
The accepted values are `zip-[0-9]`, where `zip-0` provides no
compression, and `zip-9` provides the best compression. Default is `zip-6`.
`--config` *path*
: Specifies the location of user-editable configuration files to copy into
the resulting JMOD file.
`--date `*TIMESTAMP*
: The timestamp in ISO-8601 extended offset date-time with optional time-zone
format, to use for the timestamp of the entries,
e.g. "2022-02-12T12:30:00-05:00".
`--dir` *path*
: Specifies the location where `jmod` puts extracted files from the specified
JMOD archive.
`--dry-run`
: Performs a dry run of hash mode. It identifies leaf modules and their
required modules without recording any hash values.
`--exclude` *pattern-list*
: Excludes files matching the supplied comma-separated pattern list, each
element using one the following forms:
- *glob-pattern*
- `glob:`*glob-pattern*
- `regex:`*regex-pattern*
See the [`FileSystem.getPathMatcher`](
../../api/java.base/java/nio/file/FileSystem.html#getPathMatcher(java.lang.String))
method for the syntax of *glob-pattern*. See the [`Pattern`](
../../api/java.base/java/util/regex/Pattern.html)
class for the syntax of *regex-pattern*, which represents a regular
expression.
`--hash-modules` *regex-pattern*
: Determines the leaf modules and records the hashes of the dependencies
directly and indirectly requiring them, based on the module graph of the
modules matching the given *regex-pattern*. The hashes are recorded in the
JMOD archive file being created, or a JMOD archive or modular JAR on the
module path specified by the `jmod hash` command.
`--header-files` *path*
: Specifies the location of header files to copy into the resulting JMOD
file.
`--help` or `-h`
: Prints a usage message.
`--help-extra`
: Prints help for extra options.
`--legal-notices` *path*
: Specifies the location of legal notices to copy into the resulting JMOD
file.
`--libs` *path*
: Specifies location of native libraries to copy into the resulting JMOD
file.
`--main-class` *class-name*
: Specifies main class to record in the module-info.class file.
`--man-pages` *path*
: Specifies the location of man pages to copy into the resulting JMOD file.
`--module-version` *module-version*
: Specifies the module version to record in the module-info.class file.
`--module-path` *path* or `-p` *path*
: Specifies the module path. This option is required if you also specify
`--hash-modules`.
`--target-platform` *platform*
: Specifies the target platform.
`--version`
: Prints version information of the `jmod` tool.
`@`*filename*
: Reads options from the specified file.
An options file is a text file that contains the options and values that
you would ordinarily 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 prefixinga hash symbol (`#`) to
the beginning of the line.
The following is an example of an options file for the `jmod` command:
```
#Wed Dec 07 00:40:19 EST 2016
create --class-path mods/com.greetings --module-path mlib
--cmds commands --config configfiles --header-files src/h
--libs lib --main-class com.greetings.Main
--man-pages man --module-version 1.0
--os-arch "x86_x64" --os-name "macOS"
--os-version "10.10.5" greetingsmod
```
## Extra Options for jmod
In addition to the options described in [Options for jmod], the following are
extra options that can be used with the command.
`--do-not-resolve-by-default`
: Exclude from the default root set of modules
`--warn-if-resolved`
: Hint for a tool to issue a warning if the module is resolved. One of
deprecated, deprecated-for-removal, or incubating.
## jmod Create Example
The following is an example of creating a JMOD file:
```
jmod create --class-path mods/com.greetings --cmds commands
--config configfiles --header-files src/h --libs lib
--main-class com.greetings.Main --man-pages man --module-version 1.0
--os-arch "x86_x64" --os-name "macOS"
--os-version "10.10.5" greetingsmod
```
Create a JMOD file specifying the date for the entries as `2022 March 15 00:00:00`:
```
jmod create --class-path build/foo/classes --date 2022-03-15T00:00:00Z
jmods/foo1.jmod
```
## jmod Hash Example
The following example demonstrates what happens when you try to link a leaf
module (in this example, `ma`) with a required module (`mb`), and the hash
value recorded in the required module doesn't match that of the leaf module.
1. Create and compile the following `.java` files:
- `jmodhashex/src/ma/module-info.java`
```
module ma {
requires mb;
}
```
- `jmodhashex/src/mb/module-info.java`
```
module mb {
}
```
- `jmodhashex2/src/ma/module-info.java`
```
module ma {
requires mb;
}
```
- `jmodhashex2/src/mb/module-info.java`
```
module mb {
}
```
2. Create a JMOD archive for each module. Create the directories
`jmodhashex/jmods` and `jmodhashex2/jmods`, and then run the following
commands from the `jmodhashex` directory, then from the `jmodhashex2`
directory:
- `jmod create --class-path mods/ma jmods/ma.jmod`
- `jmod create --class-path mods/mb jmods/mb.jmod`
3. Optionally preview the `jmod hash` command. Run the following command from
the `jmodhashex` directory:
`jmod hash --dry-run -module-path jmods --hash-modules .*`
The command prints the following:
```
Dry run:
mb
hashes ma SHA-256 07667d5032004b37b42ec2bb81b46df380cf29e66962a16481ace2e71e74073a
```
This indicates that the `jmod hash` command (without the `--dry-run`
option) will record the hash value of the leaf module `ma` in the module
`mb`.
4. Record hash values in the JMOD archive files contained in the `jmodhashex`
directory. Run the following command from the `jmodhashex` directory:
> `jmod hash --module-path jmods --hash-modules .*`
The command prints the following:
> `Hashes are recorded in module mb`
5. Print information about each JMOD archive contained in the `jmodhashex`
directory. Run the highlighted commands from the `jmodhashex` directory:
```
jmod describe jmods/ma.jmod
ma
requires mandated java.base
requires mb
jmod describe jmods/mb.jmod
mb
requires mandated java.base
hashes ma SHA-256 07667d5032004b37b42ec2bb81b46df380cf29e66962a16481ace2e71e74073a
```
6. Attempt to create a runtime image that contains the module `ma` from the
directory `jmodhashex2` but the module `mb` from the directory
`jmodhashex`. Run the following command from the `jmodhashex2` directory:
- **Linux and macOS:**
> `jlink --module-path
$JAVA_HOME/jmods:jmods/ma.jmod:../jmodhashex/jmods/mb.jmod
--add-modules ma --output ma-app`
- **Windows:**
> `jlink --module-path
%JAVA_HOME%/jmods;jmods/ma.jmod;../jmodhashex/jmods/mb.jmod
--add-modules ma --output ma-app`
The command prints an error message similar to the following:
```
Error: Hash of ma (a2d77889b0cb067df02a3abc39b01ac1151966157a68dc4241562c60499150d2) differs to
expected hash (07667d5032004b37b42ec2bb81b46df380cf29e66962a16481ace2e71e74073a) recorded in mb
```

View File

@ -1,834 +0,0 @@
.\" Copyright (c) 2018, 2024, 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.19.2
.\"
.\" Define V font for inline verbatim, using C font in formats
.\" that render this, and otherwise B font.
.ie "\f[CB]x\f[R]"x" \{\
. ftr V B
. ftr VI BI
. ftr VB B
. ftr VBI BI
.\}
.el \{\
. ftr V CR
. ftr VI CI
. ftr VB CB
. ftr VBI CBI
.\}
.TH "JPACKAGE" "1" "2025" "JDK 24-ea" "JDK Commands"
.hy
.SH NAME
.PP
jpackage - tool for packaging self-contained Java applications.
.SH SYNOPSIS
.PP
\f[V]jpackage\f[R] [\f[I]options\f[R]]
.TP
\f[I]options\f[R]
Command-line options separated by spaces.
See \f[B]jpackage Options\f[R].
.SH DESCRIPTION
.PP
The \f[V]jpackage\f[R] tool will take as input a Java application and a
Java run-time image, and produce a Java application image that includes
all the necessary dependencies.
It will be able to produce a native package in a platform-specific
format, such as an exe on Windows or a dmg on macOS.
Each format must be built on the platform it runs on, there is no
cross-platform support.
The tool will have options that allow packaged applications to be
customized in various ways.
.SH JPACKAGE OPTIONS
.SS Generic Options:
.TP
\f[V]\[at]\f[R]\f[I]filename\f[R]
Read options from a file.
.RS
.PP
This option can be used multiple times.
.RE
.TP
\f[V]--type\f[R] or \f[V]-t\f[R] \f[I]type\f[R]
The type of package to create
.RS
.PP
Valid values are: {\[dq]app-image\[dq], \[dq]exe\[dq], \[dq]msi\[dq],
\[dq]rpm\[dq], \[dq]deb\[dq], \[dq]pkg\[dq], \[dq]dmg\[dq]}
.PP
If this option is not specified a platform dependent default type will
be created.
.RE
.TP
\f[V]--app-version\f[R] \f[I]version\f[R]
Version of the application and/or package
.TP
\f[V]--copyright\f[R] \f[I]copyright\f[R]
Copyright for the application
.TP
\f[V]--description\f[R] \f[I]description\f[R]
Description of the application
.TP
\f[V]--help\f[R] or \f[V]-h\f[R]
Print the usage text with a list and description of each valid option
for the current platform to the output stream, and exit.
.TP
\f[V]--icon\f[R] \f[I]path\f[R]
Path of the icon of the application package
.RS
.PP
(absolute path or relative to the current directory)
.RE
.TP
\f[V]--name\f[R] or \f[V]-n\f[R] \f[I]name\f[R]
Name of the application and/or package
.TP
\f[V]--dest\f[R] or \f[V]-d\f[R] \f[I]destination\f[R]
Path where generated output file is placed
.RS
.PP
(absolute path or relative to the current directory).
.PP
Defaults to the current working directory.
.RE
.TP
\f[V]--resource-dir\f[R] \f[I]path\f[R]
Path to override jpackage resources
.RS
.PP
(absolute path or relative to the current directory)
.PP
Icons, template files, and other resources of jpackage can be
over-ridden by adding replacement resources to this directory.
.RE
.TP
\f[V]--temp\f[R] \f[I]directory\f[R]
Path of a new or empty directory used to create temporary files
.RS
.PP
(absolute path or relative to the current directory)
.PP
If specified, the temp dir will not be removed upon the task completion
and must be removed manually.
.PP
If not specified, a temporary directory will be created and removed upon
the task completion.
.RE
.TP
\f[V]--vendor\f[R] \f[I]vendor\f[R]
Vendor of the application
.TP
\f[V]--verbose\f[R]
Enables verbose output.
.TP
\f[V]--version\f[R]
Print the product version to the output stream and exit.
.SS Options for creating the runtime image:
.TP
\f[V]--add-modules\f[R] \f[I]module-name\f[R] [\f[V],\f[R]\f[I]module-name\f[R]...]
A comma (\[dq],\[dq]) separated list of modules to add
.RS
.PP
This module list, along with the main module (if specified) will be
passed to jlink as the --add-module argument.
If not specified, either just the main module (if --module is
specified), or the default set of modules (if --main-jar is specified)
are used.
.PP
This option can be used multiple times.
.RE
.TP
\f[V]--module-path\f[R] or \f[V]-p\f[R] \f[I]module-path\f[R] [\f[V],\f[R]\f[I]module-path\f[R]...]
A File.pathSeparator separated list of paths
.RS
.PP
Each path is either a directory of modules or the path to a modular jar,
and is absolute or relative to the current directory.
.PP
This option can be used multiple times.
.RE
.TP
\f[V]--jlink-options\f[R] \f[I]options\f[R]
A space separated list of options to pass to jlink
.RS
.PP
If not specified, defaults to \[dq]--strip-native-commands --strip-debug
--no-man-pages --no-header-files\[dq]
.PP
This option can be used multiple times.
.RE
.TP
\f[V]--runtime-image\f[R] \f[I]directory\f[R]
Path of the predefined runtime image that will be copied into the
application image
.RS
.PP
(absolute path or relative to the current directory)
.PP
If --runtime-image is not specified, jpackage will run jlink to create
the runtime image using options specified by --jlink-options.
.RE
.SS Options for creating the application image:
.TP
\f[V]--input\f[R] or \f[V]-i\f[R] \f[I]directory\f[R]
Path of the input directory that contains the files to be packaged
.RS
.PP
(absolute path or relative to the current directory)
.PP
All files in the input directory will be packaged into the application
image.
.RE
.TP
\f[V]--app-content\f[R] \f[I]additional-content\f[R] [\f[V],\f[R]\f[I]additional-content\f[R]...]
A comma separated list of paths to files and/or directories to add to
the application payload.
.RS
.PP
This option can be used more than once.
.RE
.SS Options for creating the application launcher(s):
.TP
\f[V]--add-launcher\f[R] \f[I]name\f[R]=\f[I]path\f[R]
Name of launcher, and a path to a Properties file that contains a list
of key, value pairs
.RS
.PP
(absolute path or relative to the current directory)
.PP
The keys \[dq]module\[dq], \[dq]main-jar\[dq], \[dq]main-class\[dq],
\[dq]description\[dq], \[dq]arguments\[dq], \[dq]java-options\[dq],
\[dq]icon\[dq], \[dq]launcher-as-service\[dq], \[dq]win-console\[dq],
\[dq]win-shortcut\[dq], \[dq]win-menu\[dq], and \[dq]linux-shortcut\[dq]
can be used.
.PP
These options are added to, or used to overwrite, the original command
line options to build an additional alternative launcher.
The main application launcher will be built from the command line
options.
Additional alternative launchers can be built using this option, and
this option can be used multiple times to build multiple additional
launchers.
.RE
.TP
\f[V]--arguments\f[R] \f[I]arguments\f[R]
Command line arguments to pass to the main class if no command line
arguments are given to the launcher
.RS
.PP
This option can be used multiple times.
.RE
.TP
\f[V]--java-options\f[R] \f[I]options\f[R]
Options to pass to the Java runtime
.RS
.PP
This option can be used multiple times.
.RE
.TP
\f[V]--main-class\f[R] \f[I]class-name\f[R]
Qualified name of the application main class to execute
.RS
.PP
This option can only be used if --main-jar is specified.
.RE
.TP
\f[V]--main-jar\f[R] \f[I]main-jar\f[R]
The main JAR of the application; containing the main class (specified as
a path relative to the input path)
.RS
.PP
Either --module or --main-jar option can be specified but not both.
.RE
.TP
\f[V]--module\f[R] or \f[V]-m\f[R] \f[I]module-name\f[R][/\f[I]main-class\f[R]]
The main module (and optionally main class) of the application
.RS
.PP
This module must be located on the module path.
.PP
When this option is specified, the main module will be linked in the
Java runtime image.
Either --module or --main-jar option can be specified but not both.
.RE
.SS Platform dependent options for creating the application launcher:
.SS Windows platform options (available only when running on Windows):
.TP
\f[V]--win-console\f[R]
Creates a console launcher for the application, should be specified for
application which requires console interactions
.SS macOS platform options (available only when running on macOS):
.TP
\f[V]--mac-package-identifier\f[R] \f[I]identifier\f[R]
An identifier that uniquely identifies the application for macOS
.RS
.PP
Defaults to the main class name.
.PP
May only use alphanumeric (A-Z,a-z,0-9), hyphen (-), and period (.)
characters.
.RE
.TP
\f[V]--mac-package-name\f[R] \f[I]name\f[R]
Name of the application as it appears in the Menu Bar
.RS
.PP
This can be different from the application name.
.PP
This name must be less than 16 characters long and be suitable for
displaying in the menu bar and the application Info window.
Defaults to the application name.
.RE
.TP
\f[V]--mac-package-signing-prefix\f[R] \f[I]prefix\f[R]
When signing the application package, this value is prefixed to all
components that need to be signed that don\[aq]t have an existing
package identifier.
.TP
\f[V]--mac-sign\f[R]
Request that the package or the predefined application image be signed.
.TP
\f[V]--mac-signing-keychain\f[R] \f[I]keychain-name\f[R]
Name of the keychain to search for the signing identity
.RS
.PP
If not specified, the standard keychains are used.
.RE
.TP
\f[V]--mac-signing-key-user-name\f[R] \f[I]name\f[R]
Team or user name portion in Apple signing identities
.TP
\f[V]--mac-app-store\f[R]
Indicates that the jpackage output is intended for the Mac App Store.
.TP
\f[V]--mac-entitlements\f[R] \f[I]path\f[R]
Path to file containing entitlements to use when signing executables and
libraries in the bundle
.TP
\f[V]--mac-app-category\f[R] \f[I]category\f[R]
String used to construct LSApplicationCategoryType in application plist
.RS
.PP
The default value is \[dq]utilities\[dq].
.RE
.SS Options for creating the application package:
.TP
\f[V]--about-url\f[R] \f[I]url\f[R]
URL of the application\[aq]s home page
.TP
\f[V]--app-image\f[R] \f[I]directory\f[R]
Location of the predefined application image that is used to build an
installable package (on all platforms) or to be signed (on macOS)
.RS
.PP
(absolute path or relative to the current directory)
.RE
.TP
\f[V]--file-associations\f[R] \f[I]path\f[R]
Path to a Properties file that contains list of key, value pairs
.RS
.PP
(absolute path or relative to the current directory)
.PP
The keys \[dq]extension\[dq], \[dq]mime-type\[dq], \[dq]icon\[dq], and
\[dq]description\[dq] can be used to describe the association.
.PP
This option can be used multiple times.
.RE
.TP
\f[V]--install-dir\f[R] \f[I]path\f[R]
Absolute path of the installation directory of the application (on macOS
or linux), or relative sub-path of the installation directory such as
\[dq]Program Files\[dq] or \[dq]AppData\[dq] (on Windows)
.TP
\f[V]--license-file\f[R] \f[I]path\f[R]
Path to the license file
.RS
.PP
(absolute path or relative to the current directory)
.RE
.TP
\f[V]--runtime-image\f[R] \f[I]path\f[R]
Path of the predefined runtime image to install
.RS
.PP
(absolute path or relative to the current directory)
.PP
Option is required when creating a runtime installer.
.RE
.TP
\f[V]--launcher-as-service\f[R]
Request to create an installer that will register the main application
launcher as a background service-type application.
.SS Platform dependent options for creating the application package:
.SS Windows platform options (available only when running on Windows):
.TP
\f[V]--win-dir-chooser\f[R]
Adds a dialog to enable the user to choose a directory in which the
product is installed.
.TP
\f[V]--win-help-url\f[R] \f[I]url\f[R]
URL where user can obtain further information or technical support
.TP
\f[V]--win-menu\f[R]
Request to add a Start Menu shortcut for this application
.TP
\f[V]--win-menu-group\f[R] \f[I]menu-group-name\f[R]
Start Menu group this application is placed in
.TP
\f[V]--win-per-user-install\f[R]
Request to perform an install on a per-user basis
.TP
\f[V]--win-shortcut\f[R]
Request to create a desktop shortcut for this application
.TP
\f[V]--win-shortcut-prompt\f[R]
Adds a dialog to enable the user to choose if shortcuts will be created
by installer
.TP
\f[V]--win-update-url\f[R] \f[I]url\f[R]
URL of available application update information
.TP
\f[V]--win-upgrade-uuid\f[R] \f[I]id\f[R]
UUID associated with upgrades for this package
.SS Linux platform options (available only when running on Linux):
.TP
\f[V]--linux-package-name\f[R] \f[I]name\f[R]
Name for Linux package
.RS
.PP
Defaults to the application name.
.RE
.TP
\f[V]--linux-deb-maintainer\f[R] \f[I]email-address\f[R]
Maintainer for .deb bundle
.TP
\f[V]--linux-menu-group\f[R] \f[I]menu-group-name\f[R]
Menu group this application is placed in
.TP
\f[V]--linux-package-deps\f[R]
Required packages or capabilities for the application
.TP
\f[V]--linux-rpm-license-type\f[R] \f[I]type\f[R]
Type of the license (\[dq]License: \f[I]value\f[R]\[dq] of the RPM
\&.spec)
.TP
\f[V]--linux-app-release\f[R] \f[I]release\f[R]
Release value of the RPM <name>.spec file or Debian revision value of
the DEB control file
.TP
\f[V]--linux-app-category\f[R] \f[I]category-value\f[R]
Group value of the RPM /.spec file or Section value of DEB control file
.TP
\f[V]--linux-shortcut\f[R]
Creates a shortcut for the application.
.SS macOS platform options (available only when running on macOS):
.TP
\f[V]--mac-dmg-content\f[R] \f[I]additional-content\f[R] [\f[V],\f[R]\f[I]additional-content\f[R]...]
Include all the referenced content in the dmg.
.RS
.PP
This option can be used more than once.
.RE
.SH JPACKAGE EXAMPLES
.IP
.nf
\f[CB]
Generate an application package suitable for the host system:
\f[R]
.fi
.IP
.nf
\f[CB]
For a modular application:
jpackage -n name -p modulePath -m moduleName/className
For a non-modular application:
jpackage -i inputDir -n name \[rs]
--main-class className --main-jar myJar.jar
From a pre-built application image:
jpackage -n name --app-image appImageDir
\f[R]
.fi
.IP
.nf
\f[CB]
Generate an application image:
\f[R]
.fi
.IP
.nf
\f[CB]
For a modular application:
jpackage --type app-image -n name -p modulePath \[rs]
-m moduleName/className
For a non-modular application:
jpackage --type app-image -i inputDir -n name \[rs]
--main-class className --main-jar myJar.jar
To provide your own options to jlink, run jlink separately:
jlink --output appRuntimeImage -p modulePath \[rs]
--add-modules moduleName \[rs]
--no-header-files [<additional jlink options>...]
jpackage --type app-image -n name \[rs]
-m moduleName/className --runtime-image appRuntimeImage
\f[R]
.fi
.IP
.nf
\f[CB]
Generate a Java runtime package:
\f[R]
.fi
.IP
.nf
\f[CB]
jpackage -n name --runtime-image <runtime-image>
\f[R]
.fi
.IP
.nf
\f[CB]
Sign the predefined application image (on macOS):
\f[R]
.fi
.IP
.nf
\f[CB]
jpackage --type app-image --app-image <app-image> \[rs]
--mac-sign [<additional signing options>...]
Note: the only additional options that are permitted in this mode are:
the set of additional mac signing options and --verbose
\f[R]
.fi
.SH JPACKAGE RESOURCE DIRECTORY
.PP
Icons, template files, and other resources of jpackage can be
over-ridden by adding replacement resources to this directory.
jpackage will lookup files by specific names in the resource directory.
.SS Resource directory files considered only when running on Linux:
.TP
\f[V]<launcher-name>.png\f[R]
Application launcher icon
.RS
.PP
Default resource is \f[I]JavaApp.png\f[R]
.RE
.TP
\f[V]<launcher-name>.desktop\f[R]
A desktop file to be used with \f[V]xdg-desktop-menu\f[R] command
.RS
.PP
Considered with application launchers registered for file associations
and/or have an icon
.PP
Default resource is \f[I]template.desktop\f[R]
.RE
.SS Resource directory files considered only when building Linux DEB/RPM installer:
.TP
\f[V]<package-name>-<launcher-name>.service\f[R]
systemd unit file for application launcher registered as a background
service-type application
.RS
.PP
Default resource is \f[I]unit-template.service\f[R]
.RE
.SS Resource directory files considered only when building Linux RPM installer:
.TP
\f[V]<package-name>.spec\f[R]
RPM spec file
.RS
.PP
Default resource is \f[I]template.spec\f[R]
.RE
.SS Resource directory files considered only when building Linux DEB installer:
.TP
\f[V]control\f[R]
Control file
.RS
.PP
Default resource is \f[I]template.control\f[R]
.RE
.TP
\f[V]copyright\f[R]
Copyright file
.RS
.PP
Default resource is \f[I]template.copyright\f[R]
.RE
.TP
\f[V]preinstall\f[R]
Pre-install shell script
.RS
.PP
Default resource is \f[I]template.preinstall\f[R]
.RE
.TP
\f[V]prerm\f[R]
Pre-remove shell script
.RS
.PP
Default resource is \f[I]template.prerm\f[R]
.RE
.TP
\f[V]postinstall\f[R]
Post-install shell script
.RS
.PP
Default resource is \f[I]template.postinstall\f[R]
.RE
.TP
\f[V]postrm\f[R]
Post-remove shell script
.RS
.PP
Default resource is \f[I]template.postrm\f[R]
.RE
.SS Resource directory files considered only when running on Windows:
.TP
\f[V]<launcher-name>.ico\f[R]
Application launcher icon
.RS
.PP
Default resource is \f[I]JavaApp.ico\f[R]
.RE
.TP
\f[V]<launcher-name>.properties\f[R]
Properties file for application launcher executable
.RS
.PP
Default resource is \f[I]WinLauncher.template\f[R]
.RE
.SS Resource directory files considered only when building Windows MSI/EXE installer:
.TP
\f[V]<application-name>-post-image.wsf\f[R]
A Windows Script File (WSF) to run after building application image
.TP
\f[V]main.wxs\f[R]
Main WiX project file
.RS
.PP
Default resource is \f[I]main.wxs\f[R]
.RE
.TP
\f[V]overrides.wxi\f[R]
Overrides WiX project file
.RS
.PP
Default resource is \f[I]overrides.wxi\f[R]
.RE
.TP
\f[V]service-installer.exe\f[R]
Service installer executable
.RS
.PP
Considered if some application launchers are registered as background
service-type applications
.RE
.TP
\f[V]<launcher-name>-service-install.wxi\f[R]
Service installer WiX project file
.RS
.PP
Considered if some application launchers are registered as background
service-type applications
.PP
Default resource is \f[I]service-install.wxi\f[R]
.RE
.TP
\f[V]<launcher-name>-service-config.wxi\f[R]
Service installer WiX project file
.RS
.PP
Considered if some application launchers are registered as background
service-type applications
.PP
Default resource is \f[I]service-config.wxi\f[R]
.RE
.TP
\f[V]InstallDirNotEmptyDlg.wxs\f[R]
WiX project file for installer UI dialog checking installation directory
doesn\[aq]t exist or is empty
.RS
.PP
Default resource is \f[I]InstallDirNotEmptyDlg.wxs\f[R]
.RE
.TP
\f[V]ShortcutPromptDlg.wxs\f[R]
WiX project file for installer UI dialog configuring shortcuts
.RS
.PP
Default resource is \f[I]ShortcutPromptDlg.wxs\f[R]
.RE
.TP
\f[V]bundle.wxf\f[R]
WiX project file with the hierarchy of components of application image
.TP
\f[V]ui.wxf\f[R]
WiX project file for installer UI
.SS Resource directory files considered only when building Windows EXE installer:
.TP
\f[V]WinInstaller.properties\f[R]
Properties file for the installer executable
.RS
.PP
Default resource is \f[I]WinInstaller.template\f[R]
.RE
.TP
\f[V]<package-name>-post-msi.wsf\f[R]
A Windows Script File (WSF) to run after building embedded MSI installer
for EXE installer
.SS Resource directory files considered only when running on macOS:
.TP
\f[V]<launcher-name>.icns\f[R]
Application launcher icon
.RS
.PP
Default resource is \f[I]JavaApp.icns\f[R]
.RE
.TP
\f[V]Info.plist\f[R]
Application property list file
.RS
.PP
Default resource is \f[I]Info-lite.plist.template\f[R]
.RE
.TP
\f[V]Runtime-Info.plist\f[R]
Java Runtime property list file
.RS
.PP
Default resource is \f[I]Runtime-Info.plist.template\f[R]
.RE
.TP
\f[V]<application-name>.entitlements\f[R]
Signing entitlements property list file
.RS
.PP
Default resource is \f[I]sandbox.plist\f[R]
.RE
.SS Resource directory files considered only when building macOS PKG/DMG installer:
.TP
\f[V]<package-name>-post-image.sh\f[R]
Shell script to run after building application image
.SS Resource directory files considered only when building macOS PKG installer:
.TP
\f[V]uninstaller\f[R]
Uninstaller shell script
.RS
.PP
Considered if some application launchers are registered as background
service-type applications
.PP
Default resource is \f[I]uninstall.command.template\f[R]
.RE
.TP
\f[V]preinstall\f[R]
Pre-install shell script
.RS
.PP
Default resource is \f[I]preinstall.template\f[R]
.RE
.TP
\f[V]postinstall\f[R]
Post-install shell script
.RS
.PP
Default resource is \f[I]postinstall.template\f[R]
.RE
.TP
\f[V]services-preinstall\f[R]
Pre-install shell script for services package
.RS
.PP
Considered if some application launchers are registered as background
service-type applications
.PP
Default resource is \f[I]services-preinstall.template\f[R]
.RE
.TP
\f[V]services-postinstall\f[R]
Post-install shell script for services package
.RS
.PP
Considered if some application launchers are registered as background
service-type applications
.PP
Default resource is \f[I]services-postinstall.template\f[R]
.RE
.TP
\f[V]<package-name>-background.png\f[R]
Background image
.RS
.PP
Default resource is \f[I]background_pkg.png\f[R]
.RE
.TP
\f[V]<package-name>-background-darkAqua.png\f[R]
Dark background image
.RS
.PP
Default resource is \f[I]background_pkg.png\f[R]
.RE
.TP
\f[V]product-def.plist\f[R]
Package property list file
.RS
.PP
Default resource is \f[I]product-def.plist\f[R]
.RE
.TP
\f[V]<package-name>-<launcher-name>.plist\f[R]
launchd property list file for application launcher registered as a
background service-type application
.RS
.PP
Default resource is \f[I]launchd.plist.template\f[R]
.RE
.SS Resource directory files considered only when building macOS DMG installer:
.TP
\f[V]<package-name>-dmg-setup.scpt\f[R]
Setup AppleScript script
.RS
.PP
Default resource is \f[I]DMGsetup.scpt\f[R]
.RE
.TP
\f[V]<package-name>-license.plist\f[R]
License property list file
.RS
.PP
Default resource is \f[I]lic_template.plist\f[R]
.RE
.TP
\f[V]<package-name>-background.tiff\f[R]
Background image
.RS
.PP
Default resource is \f[I]background_dmg.tiff\f[R]
.RE
.TP
\f[V]<package-name>-volume.icns\f[R]
Volume icon
.RS
.PP
Default resource is \f[I]JavaApp.icns\f[R]
.RE

View File

@ -0,0 +1,791 @@
---
# Copyright (c) 2018, 2024, 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.
#
title: 'JPACKAGE(1) JDK @@VERSION_SHORT@@ | JDK Commands'
date: @@COPYRIGHT_YEAR@@
lang: en
---
## Name
jpackage - tool for packaging self-contained Java applications.
## Synopsis
`jpackage` \[*options*\]
*options*
: Command-line options separated by spaces. See [jpackage Options].
## Description
The `jpackage` tool will take as input a Java application and a Java run-time image, and produce a Java application image that includes all the necessary dependencies. It will be able to produce a native package in a platform-specific format, such as an exe on Windows or a dmg on macOS. Each format must be built on the platform it runs on, there is no cross-platform support. The tool will have options that allow packaged applications to be customized in various ways.
## jpackage Options
### Generic Options:
`@`*filename*
: Read options from a file.
This option can be used multiple times.
<a id="option-type">`--type` or `-t` *type*</a>
: The type of package to create
Valid values are: {"app-image", "exe", "msi", "rpm", "deb", "pkg", "dmg"}
If this option is not specified a platform dependent
default type will be created.
<a id="option-app-version">`--app-version` *version*</a>
: Version of the application and/or package
<a id="option-copyright">`--copyright` *copyright*</a>
: Copyright for the application
<a id="option-description">`--description` *description*</a>
: Description of the application
<a id="option-help">`--help` or `-h`</a>
: Print the usage text with a list and description of each valid
option for the current platform to the output stream, and exit.
<a id="option-icon">`--icon` *path*</a>
: Path of the icon of the application package
(absolute path or relative to the current directory)
<a id="option-name">`--name` or `-n` *name*</a>
: Name of the application and/or package
<a id="option-dest">`--dest` or `-d` *destination*</a>
: Path where generated output file is placed
(absolute path or relative to the current directory).
Defaults to the current working directory.
<a id="option-resource-dir">`--resource-dir` *path*</a>
: Path to override jpackage resources
(absolute path or relative to the current directory)
Icons, template files, and other resources of jpackage can be
over-ridden by adding replacement resources to this directory.
<a id="option-temp">`--temp` *directory*</a>
: Path of a new or empty directory used to create temporary files
(absolute path or relative to the current directory)
If specified, the temp dir will not be removed upon the task
completion and must be removed manually.
If not specified, a temporary directory will be created and
removed upon the task completion.
<a id="option-vendor">`--vendor` *vendor*</a>
: Vendor of the application
<a id="option-verbose">`--verbose`</a>
: Enables verbose output.
<a id="option-version">`--version`</a>
: Print the product version to the output stream and exit.
### Options for creating the runtime image:
<a id="option-add-modules">`--add-modules` *module-name* \[`,`*module-name*...\]</a>
: A comma (",") separated list of modules to add
This module list, along with the main module (if specified)
will be passed to jlink as the --add-module argument.
If not specified, either just the main module (if --module is
specified), or the default set of modules (if --main-jar is
specified) are used.
This option can be used multiple times.
<a id="option-module-path">`--module-path` or `-p` *module-path* \[`,`*module-path*...\]</a>
: A File.pathSeparator separated list of paths
Each path is either a directory of modules or the path to a
modular jar, and is absolute or relative to the current directory.
This option can be used multiple times.
<a id="option-jlink-options">`--jlink-options` *options*</a>
: A space separated list of options to pass to jlink
If not specified, defaults to "--strip-native-commands
--strip-debug --no-man-pages --no-header-files"
This option can be used multiple times.
<a id="option-runtime-image">`--runtime-image` *directory*</a>
: Path of the predefined runtime image that will be copied into
the application image
(absolute path or relative to the current directory)
If --runtime-image is not specified, jpackage will run jlink to
create the runtime image using options specified by --jlink-options.
### Options for creating the application image:
<a id="option-input">`--input` or `-i` *directory*</a>
: Path of the input directory that contains the files to be packaged
(absolute path or relative to the current directory)
All files in the input directory will be packaged into the
application image.
<a id="option-app-content">`--app-content` *additional-content* \[`,`*additional-content*...\]</a>
: A comma separated list of paths to files and/or directories
to add to the application payload.
This option can be used more than once.
### Options for creating the application launcher(s):
<a id="option-add-launcher">`--add-launcher` *name*=*path*</a>
: Name of launcher, and a path to a Properties file that contains
a list of key, value pairs
(absolute path or relative to the current directory)
The keys "module", "main-jar", "main-class", "description",
"arguments", "java-options", "icon", "launcher-as-service",
"win-console", "win-shortcut", "win-menu", and "linux-shortcut"
can be used.
These options are added to, or used to overwrite, the original
command line options to build an additional alternative launcher.
The main application launcher will be built from the command line
options. Additional alternative launchers can be built using
this option, and this option can be used multiple times to
build multiple additional launchers.
<a id="option-arguments">`--arguments` *arguments*</a>
: Command line arguments to pass to the main class if no command
line arguments are given to the launcher
This option can be used multiple times.
<a id="option-java-options">`--java-options` *options*</a>
: Options to pass to the Java runtime
This option can be used multiple times.
<a id="option-main-class">`--main-class` *class-name*</a>
: Qualified name of the application main class to execute
This option can only be used if --main-jar is specified.
<a id="option-main-jar">`--main-jar` *main-jar*</a>
: The main JAR of the application; containing the main class
(specified as a path relative to the input path)
Either --module or --main-jar option can be specified but not
both.
<a id="option-module">`--module` or `-m` *module-name*[/*main-class*]</a>
: The main module (and optionally main class) of the application
This module must be located on the module path.
When this option is specified, the main module will be linked
in the Java runtime image. Either --module or --main-jar
option can be specified but not both.
### Platform dependent options for creating the application launcher:
#### Windows platform options (available only when running on Windows):
<a id="option-win-console">`--win-console`</a>
: Creates a console launcher for the application, should be
specified for application which requires console interactions
#### macOS platform options (available only when running on macOS):
<a id="option-mac-package-identifier">`--mac-package-identifier` *identifier*</a>
: An identifier that uniquely identifies the application for macOS
Defaults to the main class name.
May only use alphanumeric (A-Z,a-z,0-9), hyphen (-),
and period (.) characters.
<a id="option-mac-package-name">`--mac-package-name` *name*</a>
: Name of the application as it appears in the Menu Bar
This can be different from the application name.
This name must be less than 16 characters long and be suitable for
displaying in the menu bar and the application Info window.
Defaults to the application name.
<a id="option-mac-package-signing-prefix">`--mac-package-signing-prefix` *prefix*</a>
: When signing the application package, this value is prefixed to all
components that need to be signed that don't have
an existing package identifier.
<a id="option-mac-sign">`--mac-sign`</a>
: Request that the package or the predefined application image be signed.
<a id="option-mac-signing-keychain">`--mac-signing-keychain` *keychain-name*</a>
: Name of the keychain to search for the signing identity
If not specified, the standard keychains are used.
<a id="option-mac-signing-key-user-name">`--mac-signing-key-user-name` *name*</a>
: Team or user name portion in Apple signing identities
<a id="option-mac-app-store">`--mac-app-store`</a>
: Indicates that the jpackage output is intended for the Mac App Store.
<a id="option-mac-entitlements">`--mac-entitlements` *path*</a>
: Path to file containing entitlements to use when signing executables and libraries in the bundle
<a id="option-mac-app-category">`--mac-app-category` *category*</a>
: String used to construct LSApplicationCategoryType in application plist
The default value is "utilities".
### Options for creating the application package:
<a id="option-about-url">`--about-url` *url*</a>
: URL of the application's home page
<a id="option-app-image">`--app-image` *directory*</a>
: Location of the predefined application image that is used to build an installable package
(on all platforms) or to be signed (on macOS)
(absolute path or relative to the current directory)
<a id="option-file-associations">`--file-associations` *path*</a>
: Path to a Properties file that contains list of key, value pairs
(absolute path or relative to the current directory)
The keys "extension", "mime-type", "icon", and "description"
can be used to describe the association.
This option can be used multiple times.
<a id="option-install-dir">`--install-dir` *path*</a>
: Absolute path of the installation directory of the application (on macOS
or linux), or relative sub-path of the installation directory
such as "Program Files" or "AppData" (on Windows)
<a id="option-license-file">`--license-file` *path*</a>
: Path to the license file
(absolute path or relative to the current directory)
<a id="option-application-package-runtime-image">`--runtime-image` *path*</a>
: Path of the predefined runtime image to install
(absolute path or relative to the current directory)
Option is required when creating a runtime installer.
<a id="option-launcher-as-service">`--launcher-as-service`</a>
: Request to create an installer that will register the main
application launcher as a background service-type application.
### Platform dependent options for creating the application package:
#### Windows platform options (available only when running on Windows):
<a id="option-win-dir-chooser">`--win-dir-chooser`</a>
: Adds a dialog to enable the user to choose a directory in which
the product is installed.
<a id="option-win-help-url">`--win-help-url` *url*</a>
: URL where user can obtain further information or technical support
<a id="option-win-menu">`--win-menu`</a>
: Request to add a Start Menu shortcut for this application
<a id="option-win-menu-group">`--win-menu-group` *menu-group-name*</a>
: Start Menu group this application is placed in
<a id="option-win-per-user-install">`--win-per-user-install`</a>
: Request to perform an install on a per-user basis
<a id="option-win-shortcut">`--win-shortcut`</a>
: Request to create a desktop shortcut for this application
<a id="option-win-shortcut-prompt">`--win-shortcut-prompt`</a>
: Adds a dialog to enable the user to choose if shortcuts will be created by installer
<a id="option-win-update-url">`--win-update-url` *url*</a>
: URL of available application update information
<a id="option-win-upgrade-uuid">`--win-upgrade-uuid` *id*</a>
: UUID associated with upgrades for this package
#### Linux platform options (available only when running on Linux):
<a id="option-linux-package-name">`--linux-package-name` *name*</a>
: Name for Linux package
Defaults to the application name.
<a id="option-linux-deb-maintainer">`--linux-deb-maintainer` *email-address*</a>
: Maintainer for .deb bundle
<a id="option-linux-menu-group">`--linux-menu-group` *menu-group-name*</a>
: Menu group this application is placed in
<a id="option-linux-package-deps">`--linux-package-deps`</a>
: Required packages or capabilities for the application
<a id="option-linux-rpm-license-type">`--linux-rpm-license-type` *type*</a>
: Type of the license ("License: *value*" of the RPM .spec)
<a id="option-linux-app-release">`--linux-app-release` *release*</a>
: Release value of the RPM \<name\>.spec file or
Debian revision value of the DEB control file
<a id="option-linux-app-category">`--linux-app-category` *category-value*</a>
: Group value of the RPM /<name/>.spec file or
Section value of DEB control file
<a id="option-linux-shortcut">`--linux-shortcut`</a>
: Creates a shortcut for the application.
#### macOS platform options (available only when running on macOS):
<a id="option-mac-dmg-content">`--mac-dmg-content` *additional-content* \[`,`*additional-content*...\]</a>
: Include all the referenced content in the dmg.
This option can be used more than once.
## jpackage Examples
```
Generate an application package suitable for the host system:
```
For a modular application:
jpackage -n name -p modulePath -m moduleName/className
For a non-modular application:
jpackage -i inputDir -n name \
--main-class className --main-jar myJar.jar
From a pre-built application image:
jpackage -n name --app-image appImageDir
```
Generate an application image:
```
For a modular application:
jpackage --type app-image -n name -p modulePath \
-m moduleName/className
For a non-modular application:
jpackage --type app-image -i inputDir -n name \
--main-class className --main-jar myJar.jar
To provide your own options to jlink, run jlink separately:
jlink --output appRuntimeImage -p modulePath \
--add-modules moduleName \
--no-header-files [<additional jlink options>...]
jpackage --type app-image -n name \
-m moduleName/className --runtime-image appRuntimeImage
```
Generate a Java runtime package:
```
jpackage -n name --runtime-image <runtime-image>
```
Sign the predefined application image (on macOS):
```
jpackage --type app-image --app-image <app-image> \
--mac-sign [<additional signing options>...]
Note: the only additional options that are permitted in this mode are:
the set of additional mac signing options and --verbose
## jpackage resource directory
Icons, template files, and other resources of jpackage can be over-ridden by
adding replacement resources to this directory.
jpackage will lookup files by specific names in the resource directory.
### Resource directory files considered only when running on Linux:
`<launcher-name>.png`
: Application launcher icon
Default resource is *JavaApp.png*
`<launcher-name>.desktop`
: A desktop file to be used with `xdg-desktop-menu` command
Considered with application launchers registered for file associations and/or have an icon
Default resource is *template.desktop*
#### Resource directory files considered only when building Linux DEB/RPM installer:
`<package-name>-<launcher-name>.service`
: systemd unit file for application launcher registered as a background service-type application
Default resource is *unit-template.service*
#### Resource directory files considered only when building Linux RPM installer:
`<package-name>.spec`
: RPM spec file
Default resource is *template.spec*
#### Resource directory files considered only when building Linux DEB installer:
`control`
: Control file
Default resource is *template.control*
`copyright`
: Copyright file
Default resource is *template.copyright*
`preinstall`
: Pre-install shell script
Default resource is *template.preinstall*
`prerm`
: Pre-remove shell script
Default resource is *template.prerm*
`postinstall`
: Post-install shell script
Default resource is *template.postinstall*
`postrm`
: Post-remove shell script
Default resource is *template.postrm*
### Resource directory files considered only when running on Windows:
`<launcher-name>.ico`
: Application launcher icon
Default resource is *JavaApp.ico*
`<launcher-name>.properties`
: Properties file for application launcher executable
Default resource is *WinLauncher.template*
#### Resource directory files considered only when building Windows MSI/EXE installer:
`<application-name>-post-image.wsf`
: A Windows Script File (WSF) to run after building application image
`main.wxs`
: Main WiX project file
Default resource is *main.wxs*
`overrides.wxi`
: Overrides WiX project file
Default resource is *overrides.wxi*
`service-installer.exe`
: Service installer executable
Considered if some application launchers are registered as background service-type applications
`<launcher-name>-service-install.wxi`
: Service installer WiX project file
Considered if some application launchers are registered as background service-type applications
Default resource is *service-install.wxi*
`<launcher-name>-service-config.wxi`
: Service installer WiX project file
Considered if some application launchers are registered as background service-type applications
Default resource is *service-config.wxi*
`InstallDirNotEmptyDlg.wxs`
: WiX project file for installer UI dialog checking installation directory doesn't exist or is empty
Default resource is *InstallDirNotEmptyDlg.wxs*
`ShortcutPromptDlg.wxs`
: WiX project file for installer UI dialog configuring shortcuts
Default resource is *ShortcutPromptDlg.wxs*
`bundle.wxf`
: WiX project file with the hierarchy of components of application image
`ui.wxf`
: WiX project file for installer UI
#### Resource directory files considered only when building Windows EXE installer:
`WinInstaller.properties`
: Properties file for the installer executable
Default resource is *WinInstaller.template*
`<package-name>-post-msi.wsf`
: A Windows Script File (WSF) to run after building embedded MSI installer for EXE installer
### Resource directory files considered only when running on macOS:
`<launcher-name>.icns`
: Application launcher icon
Default resource is *JavaApp.icns*
`Info.plist`
: Application property list file
Default resource is *Info-lite.plist.template*
`Runtime-Info.plist`
: Java Runtime property list file
Default resource is *Runtime-Info.plist.template*
`<application-name>.entitlements`
: Signing entitlements property list file
Default resource is *sandbox.plist*
#### Resource directory files considered only when building macOS PKG/DMG installer:
`<package-name>-post-image.sh`
: Shell script to run after building application image
#### Resource directory files considered only when building macOS PKG installer:
`uninstaller`
: Uninstaller shell script
Considered if some application launchers are registered as background service-type applications
Default resource is *uninstall.command.template*
`preinstall`
: Pre-install shell script
Default resource is *preinstall.template*
`postinstall`
: Post-install shell script
Default resource is *postinstall.template*
`services-preinstall`
: Pre-install shell script for services package
Considered if some application launchers are registered as background service-type applications
Default resource is *services-preinstall.template*
`services-postinstall`
: Post-install shell script for services package
Considered if some application launchers are registered as background service-type applications
Default resource is *services-postinstall.template*
`<package-name>-background.png`
: Background image
Default resource is *background_pkg.png*
`<package-name>-background-darkAqua.png`
: Dark background image
Default resource is *background_pkg.png*
`product-def.plist`
: Package property list file
Default resource is *product-def.plist*
`<package-name>-<launcher-name>.plist`
: launchd property list file for application launcher registered as a background service-type application
Default resource is *launchd.plist.template*
#### Resource directory files considered only when building macOS DMG installer:
`<package-name>-dmg-setup.scpt`
: Setup AppleScript script
Default resource is *DMGsetup.scpt*
`<package-name>-license.plist`
: License property list file
Default resource is *lic_template.plist*
`<package-name>-background.tiff`
: Background image
Default resource is *background_dmg.tiff*
`<package-name>-volume.icns`
: Volume icon
Default resource is *JavaApp.icns*

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,219 +0,0 @@
.\" Copyright (c) 2004, 2024, 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.19.2
.\"
.\" Define V font for inline verbatim, using C font in formats
.\" that render this, and otherwise B font.
.ie "\f[CB]x\f[R]"x" \{\
. ftr V B
. ftr VI BI
. ftr VB B
. ftr VBI BI
.\}
.el \{\
. ftr V CR
. ftr VI CI
. ftr VB CB
. ftr VBI CBI
.\}
.TH "JSTATD" "1" "2025" "JDK 24-ea" "JDK Commands"
.hy
.SH NAME
.PP
jstatd - monitor the creation and termination of instrumented Java
HotSpot VMs
.SH SYNOPSIS
.PP
\f[B]WARNING:\f[R] This command is experimental, unsupported, and
deprecated.
It will be removed in a future release.
.PP
\f[V]jstatd\f[R] [\f[I]options\f[R]]
.TP
\f[I]options\f[R]
This represents the \f[V]jstatd\f[R] command-line options.
See \f[B]Options for the jstatd Command\f[R].
.SH DESCRIPTION
.PP
The \f[V]jstatd\f[R] command is an RMI server application that monitors
for the creation and termination of instrumented Java HotSpot VMs and
provides an interface to enable remote monitoring tools, \f[V]jstat\f[R]
and \f[V]jps\f[R], to attach to JVMs that are running on the local host
and collect information about the JVM process.
.PP
The \f[V]jstatd\f[R] server requires an RMI registry on the local host.
The \f[V]jstatd\f[R] server attempts to attach to the RMI registry on
the default port, or on the port you specify with the \f[V]-p\f[R]
\f[V]port\f[R] option.
If an RMI registry is not found, then one is created within the
\f[V]jstatd\f[R] application that\[aq]s bound to the port that\[aq]s
indicated by the \f[V]-p\f[R] \f[V]port\f[R] option or to the default
RMI registry port when the \f[V]-p\f[R] \f[V]port\f[R] option is
omitted.
You can stop the creation of an internal RMI registry by specifying the
\f[V]-nr\f[R] option.
.SH OPTIONS FOR THE JSTATD COMMAND
.TP
\f[V]-nr\f[R]
This option does not attempt to create an internal RMI registry within
the \f[V]jstatd\f[R] process when an existing RMI registry isn\[aq]t
found.
.TP
\f[V]-p\f[R] \f[I]port\f[R]
This option sets the port number where the RMI registry is expected to
be found, or when not found, created if the \f[V]-nr\f[R] option
isn\[aq]t specified.
.TP
\f[V]-r\f[R] \f[I]rmiport\f[R]
This option sets the port number to which the RMI connector is bound.
If not specified a random available port is used.
.TP
\f[V]-n\f[R] \f[I]rminame\f[R]
This option sets the name to which the remote RMI object is bound in the
RMI registry.
The default name is \f[V]JStatRemoteHost\f[R].
If multiple \f[V]jstatd\f[R] servers are started on the same host, then
the name of the exported RMI object for each server can be made unique
by specifying this option.
However, doing so requires that the unique server name be included in
the monitoring client\[aq]s \f[V]hostid\f[R] and \f[V]vmid\f[R] strings.
.TP
\f[V]-J\f[R]\f[I]option\f[R]
This option passes a Java \f[V]option\f[R] to the JVM, where the option
is one of those described on the reference page for the Java application
launcher.
For example, \f[V]-J-Xms48m\f[R] sets the startup memory to 48 MB.
See \f[B]java\f[R].
.SH SECURITY
.PP
The \f[V]jstatd\f[R] server can monitor only JVMs for which it has the
appropriate native access permissions.
Therefore, the \f[V]jstatd\f[R] process must be running with the same
user credentials as the target JVMs.
Some user credentials, such as the root user in Linux and macOS
operating systems, have permission to access the instrumentation
exported by any JVM on the system.
A \f[V]jstatd\f[R] process running with such credentials can monitor any
JVM on the system, but introduces additional security concerns.
.PP
The \f[V]jstatd\f[R] server doesn\[aq]t provide any authentication of
remote clients.
Therefore, running a \f[V]jstatd\f[R] server process exposes the
instrumentation export by all JVMs for which the \f[V]jstatd\f[R]
process has access permissions to any user on the network.
This exposure might be undesirable in your environment, and therefore,
local security policies should be considered before you start the
\f[V]jstatd\f[R] process, particularly in production environments or on
networks that aren\[aq]t secure.
.PP
For security purposes, the \f[V]jstatd\f[R] server uses an RMI
ObjectInputFilter to allow only essential classes to be deserialized.
.PP
If your security concerns can\[aq]t be addressed, then the safest action
is to not run the \f[V]jstatd\f[R] server and use the \f[V]jstat\f[R]
and \f[V]jps\f[R] tools locally.
However, when using \f[V]jps\f[R] to get a list of instrumented JVMs,
the list will not include any JVMs running in docker containers.
.SH REMOTE INTERFACE
.PP
The interface exported by the \f[V]jstatd\f[R] process is proprietary
and guaranteed to change.
Users and developers are discouraged from writing to this interface.
.SH EXAMPLES
.PP
The following are examples of the \f[V]jstatd\f[R] command.
The \f[V]jstatd\f[R] scripts automatically start the server in the
background.
.SH INTERNAL RMI REGISTRY
.PP
This example shows how to start a \f[V]jstatd\f[R] session with an
internal RMI registry.
This example assumes that no other server is bound to the default RMI
registry port (port \f[V]1099\f[R]).
.RS
.PP
\f[V]jstatd\f[R]
.RE
.SH EXTERNAL RMI REGISTRY
.PP
This example starts a \f[V]jstatd\f[R] session with an external RMI
registry.
.IP
.nf
\f[CB]
rmiregistry&
jstatd
\f[R]
.fi
.PP
This example starts a \f[V]jstatd\f[R] session with an external RMI
registry server on port \f[V]2020\f[R].
.IP
.nf
\f[CB]
jrmiregistry 2020&
jstatd -p 2020
\f[R]
.fi
.PP
This example starts a \f[V]jstatd\f[R] session with an external RMI
registry server on port \f[V]2020\f[R] and JMX connector bound to port
\f[V]2021\f[R].
.IP
.nf
\f[CB]
jrmiregistry 2020&
jstatd -p 2020 -r 2021
\f[R]
.fi
.PP
This example starts a \f[V]jstatd\f[R] session with an external RMI
registry on port 2020 that\[aq]s bound to
\f[V]AlternateJstatdServerName\f[R].
.IP
.nf
\f[CB]
rmiregistry 2020&
jstatd -p 2020 -n AlternateJstatdServerName
\f[R]
.fi
.SH STOP THE CREATION OF AN IN-PROCESS RMI REGISTRY
.PP
This example starts a \f[V]jstatd\f[R] session that doesn\[aq]t create
an RMI registry when one isn\[aq]t found.
This example assumes an RMI registry is already running.
If an RMI registry isn\[aq]t running, then an error message is
displayed.
.RS
.PP
\f[V]jstatd -nr\f[R]
.RE
.SH ENABLE RMI LOGGING
.PP
This example starts a \f[V]jstatd\f[R] session with RMI logging
capabilities enabled.
This technique is useful as a troubleshooting aid or for monitoring
server activities.
.RS
.PP
\f[V]jstatd -J-Djava.rmi.server.logCalls=true\f[R]
.RE

View File

@ -0,0 +1,180 @@
---
# Copyright (c) 2004, 2024, 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.
#
title: 'JSTATD(1) JDK @@VERSION_SHORT@@ | JDK Commands'
date: @@COPYRIGHT_YEAR@@
lang: en
---
## Name
jstatd - monitor the creation and termination of instrumented Java HotSpot VMs
## Synopsis
**WARNING:** This command is experimental, unsupported, and deprecated. It will be removed in a future release.
`jstatd` \[*options*\]
*options*
: This represents the `jstatd` command-line options. See [Options for the
jstatd Command].
## Description
The `jstatd` command is an RMI server application that monitors for the
creation and termination of instrumented Java HotSpot VMs and provides an
interface to enable remote monitoring tools, `jstat` and `jps`, to attach to
JVMs that are running on the local host and collect information about the JVM
process.
The `jstatd` server requires an RMI registry on the local host. The `jstatd`
server attempts to attach to the RMI registry on the default port, or on the
port you specify with the `-p` `port` option. If an RMI registry is not found,
then one is created within the `jstatd` application that's bound to the port
that's indicated by the `-p` `port` option or to the default RMI registry port
when the `-p` `port` option is omitted. You can stop the creation of an
internal RMI registry by specifying the `-nr` option.
## Options for the jstatd Command
`-nr`
: This option does not attempt to create an internal RMI registry within the
`jstatd` process when an existing RMI registry isn't found.
`-p` *port*
: This option sets the port number where the RMI registry is expected to be
found, or when not found, created if the `-nr` option isn't specified.
`-r` *rmiport*
: This option sets the port number to which the RMI connector is bound. If
not specified a random available port is used.
`-n` *rminame*
: This option sets the name to which the remote RMI object is bound in the
RMI registry. The default name is `JStatRemoteHost`. If multiple `jstatd`
servers are started on the same host, then the name of the exported RMI
object for each server can be made unique by specifying this option.
However, doing so requires that the unique server name be included in the
monitoring client's `hostid` and `vmid` strings.
`-J`*option*
: This option passes a Java `option` to the JVM, where the option is one of
those described on the reference page for the Java application launcher.
For example, `-J-Xms48m` sets the startup memory to 48 MB. See
[java](java.html).
## Security
The `jstatd` server can monitor only JVMs for which it has the appropriate
native access permissions. Therefore, the `jstatd` process must be running with
the same user credentials as the target JVMs. Some user credentials, such as
the root user in Linux and macOS operating systems, have
permission to access the instrumentation exported by any JVM on the system. A
`jstatd` process running with such credentials can monitor any JVM on the
system, but introduces additional security concerns.
The `jstatd` server doesn't provide any authentication of remote clients.
Therefore, running a `jstatd` server process exposes the instrumentation export
by all JVMs for which the `jstatd` process has access permissions to any user
on the network. This exposure might be undesirable in your environment, and
therefore, local security policies should be considered before you start the
`jstatd` process, particularly in production environments or on networks that
aren't secure.
For security purposes, the `jstatd` server uses an RMI ObjectInputFilter to allow
only essential classes to be deserialized.
If your security concerns can't be addressed,
then the safest action is to not run the `jstatd` server and use the `jstat`
and `jps` tools locally. However, when using `jps` to get a list of
instrumented JVMs, the list will not include any JVMs running in docker
containers.
## Remote Interface
The interface exported by the `jstatd` process is proprietary and guaranteed to
change. Users and developers are discouraged from writing to this interface.
## Examples
The following are examples of the `jstatd` command. The `jstatd` scripts
automatically start the server in the background.
## Internal RMI Registry
This example shows how to start a `jstatd` session with an internal RMI
registry. This example assumes that no other server is bound to the default RMI
registry port (port `1099`).
> `jstatd`
## External RMI Registry
This example starts a `jstatd` session with an external RMI registry.
```
rmiregistry&
jstatd
```
This example starts a `jstatd` session with an external RMI registry server on
port `2020`.
```
jrmiregistry 2020&
jstatd -p 2020
```
This example starts a `jstatd` session with an external RMI registry server on
port `2020` and JMX connector bound to port `2021`.
```
jrmiregistry 2020&
jstatd -p 2020 -r 2021
```
This example starts a `jstatd` session with an external RMI registry on port
2020 that's bound to `AlternateJstatdServerName`.
```
rmiregistry 2020&
jstatd -p 2020 -n AlternateJstatdServerName
```
## Stop the Creation of an In-Process RMI Registry
This example starts a `jstatd` session that doesn't create an RMI registry when
one isn't found. This example assumes an RMI registry is already running. If an
RMI registry isn't running, then an error message is displayed.
> `jstatd -nr`
## Enable RMI Logging
This example starts a `jstatd` session with RMI logging capabilities enabled.
This technique is useful as a troubleshooting aid or for monitoring server
activities.
> `jstatd
-J-Djava.rmi.server.logCalls=true`

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -138,7 +138,7 @@ public class CheckManPageOptions {
} }
Path findDefaultFile() { Path findDefaultFile() {
return findRootDir().resolve("src/jdk.javadoc/share/man/javadoc.1"); return findRootDir().resolve("src/jdk.javadoc/share/man/javadoc.md");
} }
Path findRootDir() { Path findRootDir() {
@ -264,29 +264,32 @@ public class CheckManPageOptions {
var list = new ArrayList<String>(); var list = new ArrayList<String>();
// In the Markdown man page, options are defined in one of two forms: // In the Markdown man page, options are defined in one of two forms:
// 1. options delegated to javac appear in lines of the form // 1. options delegated to javac appear in lines of the form
// - `-... // * <span id="...">`-...</span>
// 2. options implemented by the tool or doclet appear in lines of the form // 2. options implemented by the tool or doclet appear in lines of the form
// `-...` // <span id="...">`-...</span>
Pattern p1 = Pattern.compile("\\R- `-.*"); Pattern p1 = Pattern.compile("\\R* <span id=\"[^\"]+\">`-.*</span>");
Pattern p2 = Pattern.compile("\\R`-.*"); Pattern p2 = Pattern.compile("\\R<span id=\"[^\"]+\">`-.*</span>");
Pattern outer = Pattern.compile("(" + p1.pattern() + "|" + p2.pattern() + ")"); Pattern outer = Pattern.compile("(" + p1.pattern() + "|" + p2.pattern() + ")");
Matcher outerMatcher = outer.matcher(page); Matcher outerMatcher = outer.matcher(page);
// In the defining areas, option names are represented as follows: // In the defining areas, option names are represented as follows:
// `OPTION` // `OPTION` or `OPTION`
// where OPTION is the shortest string not containing whitespace or colon // where OPTION is the shortest string not containing whitespace or colon,
Pattern inner = Pattern.compile("\\s`([^:`]+)"); // and in which all '-' characters are escaped with a single backslash.
Pattern inner = Pattern.compile("[>\\s]`(-[^ :]+?)(:|`)");
while (outerMatcher.find()) { while (outerMatcher.find()) {
String lines = outerMatcher.group(); String lines = outerMatcher.group();
out.println("found:" + lines + "\n"); out.println("found:" + lines);
Matcher innerMatcher = inner.matcher(lines); Matcher innerMatcher = inner.matcher(lines);
while (innerMatcher.find()) { while (innerMatcher.find()) {
String option = innerMatcher.group(1); String option = innerMatcher.group(1);
out.println(" found option:" + option);
list.add(option); list.add(option);
} }
out.println();
} }
return list; return list;