command
stringlengths
1
42
description
stringlengths
29
182k
name
stringlengths
7
64.9k
synopsis
stringlengths
4
85.3k
options
stringclasses
593 values
examples
stringclasses
455 values
msguniq
Unifies duplicate translations in a translation catalog. Finds duplicate translations of the same message ID. Such duplicates are invalid input for other programs like msgfmt, msgmerge or msgcat. By default, duplicates are merged together. When using the --repeated option, only duplicates are output, and all other messages are discarded. Comments and extracted comments will be cumulated, except that if --use-first is specified, they will be taken from the first translation. File positions will be cumulated. When using the --unique option, duplicates are discarded. Mandatory arguments to long options are mandatory for short options too. Input file location: INPUTFILE input PO file -D, --directory=DIRECTORY add DIRECTORY to list for input files search If no input file is given or if it is -, standard input is read. Output file location: -o, --output-file=FILE write output to specified file The results are written to standard output if no output file is specified or if it is -. Message selection: -d, --repeated print only duplicates -u, --unique print only unique messages, discard duplicates Input file syntax: -P, --properties-input input file is in Java .properties syntax --stringtable-input input file is in NeXTstep/GNUstep .strings syntax Output details: -t, --to-code=NAME encoding for output --use-first use first available translation for each message, don't merge several translations --color use colors and other text attributes always --color=WHEN use colors and other text attributes if WHEN. WHEN may be 'always', 'never', 'auto', or 'html'. --style=STYLEFILE specify CSS style rule file for --color -e, --no-escape do not use C escapes in output (default) -E, --escape use C escapes in output, no extended chars --force-po write PO file even if empty -i, --indent write the .po file using indented style --no-location do not write '#: filename:line' lines -n, --add-location generate '#: filename:line' lines (default) --strict write out strict Uniforum conforming .po file -p, --properties-output write out a Java .properties file --stringtable-output write out a NeXTstep/GNUstep .strings file -w, --width=NUMBER set output page width --no-wrap do not break long message lines, longer than the output page width, into several lines -s, --sort-output generate sorted output -F, --sort-by-file sort output by file location Informative output: -h, --help display this help and exit -V, --version output version information and exit AUTHOR Written by Bruno Haible. REPORTING BUGS Report bugs in the bug tracker at <https://savannah.gnu.org/projects/gettext> or by email to <bug-gettext@gnu.org>. COPYRIGHT Copyright © 2001-2023 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. SEE ALSO The full documentation for msguniq is maintained as a Texinfo manual. If the info and msguniq programs are properly installed at your site, the command info msguniq should give you access to the complete manual. GNU gettext-tools 0.22.5 February 2024 MSGUNIQ(1)
msguniq - unify duplicate translations in message catalog
msguniq [OPTION] [INPUTFILE]
null
null
fitscheck
null
null
null
null
null
idle
null
null
null
null
null
2to3-3.12
null
null
null
null
null
pydoc3.12
null
null
null
null
null
2to3
null
null
null
null
null
python3
Python is an interpreted, interactive, object-oriented programming language that combines remarkable power with very clear syntax. For an introduction to programming in Python, see the Python Tutorial. The Python Library Reference documents built-in and standard types, constants, functions and modules. Finally, the Python Reference Manual describes the syntax and semantics of the core language in (perhaps too) much detail. (These documents may be located via the INTERNET RESOURCES below; they may be installed on your system as well.) Python's basic power can be extended with your own modules written in C or C++. On most systems such modules may be dynamically loaded. Python is also adaptable as an extension language for existing applications. See the internal documentation for hints. Documentation for installed Python modules and packages can be viewed by running the pydoc program. COMMAND LINE OPTIONS -B Don't write .pyc files on import. See also PYTHONDONTWRITEBYTECODE. -b Issue warnings about str(bytes_instance), str(bytearray_instance) and comparing bytes/bytearray with str. (-bb: issue errors) -c command Specify the command to execute (see next section). This terminates the option list (following options are passed as arguments to the command). --check-hash-based-pycs mode Configure how Python evaluates the up-to-dateness of hash-based .pyc files. -d Turn on parser debugging output (for expert only, depending on compilation options). -E Ignore environment variables like PYTHONPATH and PYTHONHOME that modify the behavior of the interpreter. -h , -? , --help Prints the usage for the interpreter executable and exits. --help-env Prints help about Python-specific environment variables and exits. --help-xoptions Prints help about implementation-specific -X options and exits. --help-all Prints complete usage information and exits. -i When a script is passed as first argument or the -c option is used, enter interactive mode after executing the script or the command. It does not read the $PYTHONSTARTUP file. This can be useful to inspect global variables or a stack trace when a script raises an exception. -I Run Python in isolated mode. This also implies -E, -P and -s. In isolated mode sys.path contains neither the script's directory nor the user's site-packages directory. All PYTHON* environment variables are ignored, too. Further restrictions may be imposed to prevent the user from injecting malicious code. -m module-name Searches sys.path for the named module and runs the corresponding .py file as a script. This terminates the option list (following options are passed as arguments to the module). -O Remove assert statements and any code conditional on the value of __debug__; augment the filename for compiled (bytecode) files by adding .opt-1 before the .pyc extension. -OO Do -O and also discard docstrings; change the filename for compiled (bytecode) files by adding .opt-2 before the .pyc extension. -P Don't automatically prepend a potentially unsafe path to sys.path such as the current directory, the script's directory or an empty string. See also the PYTHONSAFEPATH environment variable. -q Do not print the version and copyright messages. These messages are also suppressed in non-interactive mode. -s Don't add user site directory to sys.path. -S Disable the import of the module site and the site-dependent manipulations of sys.path that it entails. Also disable these manipulations if site is explicitly imported later. -u Force the stdout and stderr streams to be unbuffered. This option has no effect on the stdin stream. -v Print a message each time a module is initialized, showing the place (filename or built-in module) from which it is loaded. When given twice, print a message for each file that is checked for when searching for a module. Also provides information on module cleanup at exit. -V , --version Prints the Python version number of the executable and exits. When given twice, print more information about the build. -W argument Warning control. Python's warning machinery by default prints warning messages to sys.stderr. The simplest settings apply a particular action unconditionally to all warnings emitted by a process (even those that are otherwise ignored by default): -Wdefault # Warn once per call location -Werror # Convert to exceptions -Walways # Warn every time -Wmodule # Warn once per calling module -Wonce # Warn once per Python process -Wignore # Never warn The action names can be abbreviated as desired and the interpreter will resolve them to the appropriate action name. For example, -Wi is the same as -Wignore . The full form of argument is: action:message:category:module:lineno Empty fields match all values; trailing empty fields may be omitted. For example -W ignore::DeprecationWarning ignores all DeprecationWarning warnings. The action field is as explained above but only applies to warnings that match the remaining fields. The message field must match the whole printed warning message; this match is case-insensitive. The category field matches the warning category (ex: "DeprecationWarning"). This must be a class name; the match test whether the actual warning category of the message is a subclass of the specified warning category. The module field matches the (fully-qualified) module name; this match is case-sensitive. The lineno field matches the line number, where zero matches all line numbers and is thus equivalent to an omitted line number. Multiple -W options can be given; when a warning matches more than one option, the action for the last matching option is performed. Invalid -W options are ignored (though, a warning message is printed about invalid options when the first warning is issued). Warnings can also be controlled using the PYTHONWARNINGS environment variable and from within a Python program using the warnings module. For example, the warnings.filterwarnings() function can be used to use a regular expression on the warning message. -X option Set implementation-specific option. The following options are available: -X faulthandler: enable faulthandler -X showrefcount: output the total reference count and number of used memory blocks when the program finishes or after each statement in the interactive interpreter. This only works on debug builds -X tracemalloc: start tracing Python memory allocations using the tracemalloc module. By default, only the most recent frame is stored in a traceback of a trace. Use -X tracemalloc=NFRAME to start tracing with a traceback limit of NFRAME frames -X importtime: show how long each import takes. It shows module name, cumulative time (including nested imports) and self time (excluding nested imports). Note that its output may be broken in multi-threaded application. Typical usage is python3 -X importtime -c 'import asyncio' -X dev: enable CPython's "development mode", introducing additional runtime checks which are too expensive to be enabled by default. It will not be more verbose than the default if the code is correct: new warnings are only emitted when an issue is detected. Effect of the developer mode: * Add default warning filter, as -W default * Install debug hooks on memory allocators: see the PyMem_SetupDebugHooks() C function * Enable the faulthandler module to dump the Python traceback on a crash * Enable asyncio debug mode * Set the dev_mode attribute of sys.flags to True * io.IOBase destructor logs close() exceptions -X utf8: enable UTF-8 mode for operating system interfaces, overriding the default locale-aware mode. -X utf8=0 explicitly disables UTF-8 mode (even when it would otherwise activate automatically). See PYTHONUTF8 for more details -X pycache_prefix=PATH: enable writing .pyc files to a parallel tree rooted at the given directory instead of to the code tree. -X warn_default_encoding: enable opt-in EncodingWarning for 'encoding=None' -X no_debug_ranges: disable the inclusion of the tables mapping extra location information (end line, start column offset and end column offset) to every instruction in code objects. This is useful when smaller code objects and pyc files are desired as well as suppressing the extra visual location indicators when the interpreter displays tracebacks. -X frozen_modules=[on|off]: whether or not frozen modules should be used. The default is "on" (or "off" if you are running a local build). -X int_max_str_digits=number: limit the size of int<->str conversions. This helps avoid denial of service attacks when parsing untrusted data. The default is sys.int_info.default_max_str_digits. 0 disables. -x Skip the first line of the source. This is intended for a DOS specific hack only. Warning: the line numbers in error messages will be off by one! INTERPRETER INTERFACE The interpreter interface resembles that of the UNIX shell: when called with standard input connected to a tty device, it prompts for commands and executes them until an EOF is read; when called with a file name argument or with a file as standard input, it reads and executes a script from that file; when called with -c command, it executes the Python statement(s) given as command. Here command may contain multiple statements separated by newlines. Leading whitespace is significant in Python statements! In non-interactive mode, the entire input is parsed before it is executed. If available, the script name and additional arguments thereafter are passed to the script in the Python variable sys.argv, which is a list of strings (you must first import sys to be able to access it). If no script name is given, sys.argv[0] is an empty string; if -c is used, sys.argv[0] contains the string '-c'. Note that options interpreted by the Python interpreter itself are not placed in sys.argv. In interactive mode, the primary prompt is `>>>'; the second prompt (which appears when a command is not complete) is `...'. The prompts can be changed by assignment to sys.ps1 or sys.ps2. The interpreter quits when it reads an EOF at a prompt. When an unhandled exception occurs, a stack trace is printed and control returns to the primary prompt; in non-interactive mode, the interpreter exits after printing the stack trace. The interrupt signal raises the KeyboardInterrupt exception; other UNIX signals are not caught (except that SIGPIPE is sometimes ignored, in favor of the IOError exception). Error messages are written to stderr. FILES AND DIRECTORIES These are subject to difference depending on local installation conventions; ${prefix} and ${exec_prefix} are installation-dependent and should be interpreted as for GNU software; they may be the same. The default for both is /usr/local. ${exec_prefix}/bin/python Recommended location of the interpreter. ${prefix}/lib/python<version> ${exec_prefix}/lib/python<version> Recommended locations of the directories containing the standard modules. ${prefix}/include/python<version> ${exec_prefix}/include/python<version> Recommended locations of the directories containing the include files needed for developing Python extensions and embedding the interpreter. ENVIRONMENT VARIABLES PYTHONSAFEPATH If this is set to a non-empty string, don't automatically prepend a potentially unsafe path to sys.path such as the current directory, the script's directory or an empty string. See also the -P option. PYTHONHOME Change the location of the standard Python libraries. By default, the libraries are searched in ${prefix}/lib/python<version> and ${exec_prefix}/lib/python<version>, where ${prefix} and ${exec_prefix} are installation-dependent directories, both defaulting to /usr/local. When $PYTHONHOME is set to a single directory, its value replaces both ${prefix} and ${exec_prefix}. To specify different values for these, set $PYTHONHOME to ${prefix}:${exec_prefix}. PYTHONPATH Augments the default search path for module files. The format is the same as the shell's $PATH: one or more directory pathnames separated by colons. Non-existent directories are silently ignored. The default search path is installation dependent, but generally begins with ${prefix}/lib/python<version> (see PYTHONHOME above). The default search path is always appended to $PYTHONPATH. If a script argument is given, the directory containing the script is inserted in the path in front of $PYTHONPATH. The search path can be manipulated from within a Python program as the variable sys.path. PYTHONPLATLIBDIR Override sys.platlibdir. PYTHONSTARTUP If this is the name of a readable file, the Python commands in that file are executed before the first prompt is displayed in interactive mode. The file is executed in the same name space where interactive commands are executed so that objects defined or imported in it can be used without qualification in the interactive session. You can also change the prompts sys.ps1 and sys.ps2 in this file. PYTHONOPTIMIZE If this is set to a non-empty string it is equivalent to specifying the -O option. If set to an integer, it is equivalent to specifying -O multiple times. PYTHONDEBUG If this is set to a non-empty string it is equivalent to specifying the -d option. If set to an integer, it is equivalent to specifying -d multiple times. PYTHONDONTWRITEBYTECODE If this is set to a non-empty string it is equivalent to specifying the -B option (don't try to write .pyc files). PYTHONINSPECT If this is set to a non-empty string it is equivalent to specifying the -i option. PYTHONIOENCODING If this is set before running the interpreter, it overrides the encoding used for stdin/stdout/stderr, in the syntax encodingname:errorhandler The errorhandler part is optional and has the same meaning as in str.encode. For stderr, the errorhandler part is ignored; the handler will always be ´backslashreplace´. PYTHONNOUSERSITE If this is set to a non-empty string it is equivalent to specifying the -s option (Don't add the user site directory to sys.path). PYTHONUNBUFFERED If this is set to a non-empty string it is equivalent to specifying the -u option. PYTHONVERBOSE If this is set to a non-empty string it is equivalent to specifying the -v option. If set to an integer, it is equivalent to specifying -v multiple times. PYTHONWARNINGS If this is set to a comma-separated string it is equivalent to specifying the -W option for each separate value. PYTHONHASHSEED If this variable is set to "random", a random value is used to seed the hashes of str and bytes objects. If PYTHONHASHSEED is set to an integer value, it is used as a fixed seed for generating the hash() of the types covered by the hash randomization. Its purpose is to allow repeatable hashing, such as for selftests for the interpreter itself, or to allow a cluster of python processes to share hash values. The integer must be a decimal number in the range [0,4294967295]. Specifying the value 0 will disable hash randomization. PYTHONINTMAXSTRDIGITS Limit the maximum digit characters in an int value when converting from a string and when converting an int back to a str. A value of 0 disables the limit. Conversions to or from bases 2, 4, 8, 16, and 32 are never limited. PYTHONMALLOC Set the Python memory allocators and/or install debug hooks. The available memory allocators are malloc and pymalloc. The available debug hooks are debug, malloc_debug, and pymalloc_debug. When Python is compiled in debug mode, the default is pymalloc_debug and the debug hooks are automatically used. Otherwise, the default is pymalloc. PYTHONMALLOCSTATS If set to a non-empty string, Python will print statistics of the pymalloc memory allocator every time a new pymalloc object arena is created, and on shutdown. This variable is ignored if the $PYTHONMALLOC environment variable is used to force the malloc(3) allocator of the C library, or if Python is configured without pymalloc support. PYTHONASYNCIODEBUG If this environment variable is set to a non-empty string, enable the debug mode of the asyncio module. PYTHONTRACEMALLOC If this environment variable is set to a non-empty string, start tracing Python memory allocations using the tracemalloc module. The value of the variable is the maximum number of frames stored in a traceback of a trace. For example, PYTHONTRACEMALLOC=1 stores only the most recent frame. PYTHONFAULTHANDLER If this environment variable is set to a non-empty string, faulthandler.enable() is called at startup: install a handler for SIGSEGV, SIGFPE, SIGABRT, SIGBUS and SIGILL signals to dump the Python traceback. This is equivalent to the -X faulthandler option. PYTHONEXECUTABLE If this environment variable is set, sys.argv[0] will be set to its value instead of the value got through the C runtime. Only works on Mac OS X. PYTHONUSERBASE Defines the user base directory, which is used to compute the path of the user site-packages directory and installation paths for python -m pip install --user. PYTHONPROFILEIMPORTTIME If this environment variable is set to a non-empty string, Python will show how long each import takes. This is exactly equivalent to setting -X importtime on the command line. PYTHONBREAKPOINT If this environment variable is set to 0, it disables the default debugger. It can be set to the callable of your debugger of choice. Debug-mode variables Setting these variables only has an effect in a debug build of Python, that is, if Python was configured with the --with-pydebug build option. PYTHONDUMPREFS If this environment variable is set, Python will dump objects and reference counts still alive after shutting down the interpreter. AUTHOR The Python Software Foundation: https://www.python.org/psf/ INTERNET RESOURCES Main website: https://www.python.org/ Documentation: https://docs.python.org/ Developer resources: https://devguide.python.org/ Downloads: https://www.python.org/downloads/ Module repository: https://pypi.org/ Newsgroups: comp.lang.python, comp.lang.python.announce LICENSING Python is distributed under an Open Source license. See the file "LICENSE" in the Python source distribution for information on terms & conditions for accessing and otherwise using Python and for a DISCLAIMER OF ALL WARRANTIES. PYTHON(1)
python - an interpreted, interactive, object-oriented programming language
python [ -B ] [ -b ] [ -d ] [ -E ] [ -h ] [ -i ] [ -I ] [ -m module-name ] [ -q ] [ -O ] [ -OO ] [ -P ] [ -s ] [ -S ] [ -u ] [ -v ] [ -V ] [ -W argument ] [ -x ] [ -X option ] [ -? ] [ --check-hash-based-pycs default | always | never ] [ --help ] [ --help-env ] [ --help-xoptions ] [ --help-all ] [ -c command | script | - ] [ arguments ]
null
null
pip3.12
null
null
null
null
null
pydoc
null
null
null
null
null
python
null
null
null
null
null
pip3
null
null
null
null
null
python3.12-config
null
null
null
null
null
idle3
null
null
null
null
null
idle3.12
null
null
null
null
null
python-config
null
null
null
null
null
python3-config
null
null
null
null
null
pip
null
null
null
null
null
python3.12-gdb.py
null
null
null
null
null
python3.12
Python is an interpreted, interactive, object-oriented programming language that combines remarkable power with very clear syntax. For an introduction to programming in Python, see the Python Tutorial. The Python Library Reference documents built-in and standard types, constants, functions and modules. Finally, the Python Reference Manual describes the syntax and semantics of the core language in (perhaps too) much detail. (These documents may be located via the INTERNET RESOURCES below; they may be installed on your system as well.) Python's basic power can be extended with your own modules written in C or C++. On most systems such modules may be dynamically loaded. Python is also adaptable as an extension language for existing applications. See the internal documentation for hints. Documentation for installed Python modules and packages can be viewed by running the pydoc program. COMMAND LINE OPTIONS -B Don't write .pyc files on import. See also PYTHONDONTWRITEBYTECODE. -b Issue warnings about str(bytes_instance), str(bytearray_instance) and comparing bytes/bytearray with str. (-bb: issue errors) -c command Specify the command to execute (see next section). This terminates the option list (following options are passed as arguments to the command). --check-hash-based-pycs mode Configure how Python evaluates the up-to-dateness of hash-based .pyc files. -d Turn on parser debugging output (for expert only, depending on compilation options). -E Ignore environment variables like PYTHONPATH and PYTHONHOME that modify the behavior of the interpreter. -h , -? , --help Prints the usage for the interpreter executable and exits. --help-env Prints help about Python-specific environment variables and exits. --help-xoptions Prints help about implementation-specific -X options and exits. --help-all Prints complete usage information and exits. -i When a script is passed as first argument or the -c option is used, enter interactive mode after executing the script or the command. It does not read the $PYTHONSTARTUP file. This can be useful to inspect global variables or a stack trace when a script raises an exception. -I Run Python in isolated mode. This also implies -E, -P and -s. In isolated mode sys.path contains neither the script's directory nor the user's site-packages directory. All PYTHON* environment variables are ignored, too. Further restrictions may be imposed to prevent the user from injecting malicious code. -m module-name Searches sys.path for the named module and runs the corresponding .py file as a script. This terminates the option list (following options are passed as arguments to the module). -O Remove assert statements and any code conditional on the value of __debug__; augment the filename for compiled (bytecode) files by adding .opt-1 before the .pyc extension. -OO Do -O and also discard docstrings; change the filename for compiled (bytecode) files by adding .opt-2 before the .pyc extension. -P Don't automatically prepend a potentially unsafe path to sys.path such as the current directory, the script's directory or an empty string. See also the PYTHONSAFEPATH environment variable. -q Do not print the version and copyright messages. These messages are also suppressed in non-interactive mode. -s Don't add user site directory to sys.path. -S Disable the import of the module site and the site-dependent manipulations of sys.path that it entails. Also disable these manipulations if site is explicitly imported later. -u Force the stdout and stderr streams to be unbuffered. This option has no effect on the stdin stream. -v Print a message each time a module is initialized, showing the place (filename or built-in module) from which it is loaded. When given twice, print a message for each file that is checked for when searching for a module. Also provides information on module cleanup at exit. -V , --version Prints the Python version number of the executable and exits. When given twice, print more information about the build. -W argument Warning control. Python's warning machinery by default prints warning messages to sys.stderr. The simplest settings apply a particular action unconditionally to all warnings emitted by a process (even those that are otherwise ignored by default): -Wdefault # Warn once per call location -Werror # Convert to exceptions -Walways # Warn every time -Wmodule # Warn once per calling module -Wonce # Warn once per Python process -Wignore # Never warn The action names can be abbreviated as desired and the interpreter will resolve them to the appropriate action name. For example, -Wi is the same as -Wignore . The full form of argument is: action:message:category:module:lineno Empty fields match all values; trailing empty fields may be omitted. For example -W ignore::DeprecationWarning ignores all DeprecationWarning warnings. The action field is as explained above but only applies to warnings that match the remaining fields. The message field must match the whole printed warning message; this match is case-insensitive. The category field matches the warning category (ex: "DeprecationWarning"). This must be a class name; the match test whether the actual warning category of the message is a subclass of the specified warning category. The module field matches the (fully-qualified) module name; this match is case-sensitive. The lineno field matches the line number, where zero matches all line numbers and is thus equivalent to an omitted line number. Multiple -W options can be given; when a warning matches more than one option, the action for the last matching option is performed. Invalid -W options are ignored (though, a warning message is printed about invalid options when the first warning is issued). Warnings can also be controlled using the PYTHONWARNINGS environment variable and from within a Python program using the warnings module. For example, the warnings.filterwarnings() function can be used to use a regular expression on the warning message. -X option Set implementation-specific option. The following options are available: -X faulthandler: enable faulthandler -X showrefcount: output the total reference count and number of used memory blocks when the program finishes or after each statement in the interactive interpreter. This only works on debug builds -X tracemalloc: start tracing Python memory allocations using the tracemalloc module. By default, only the most recent frame is stored in a traceback of a trace. Use -X tracemalloc=NFRAME to start tracing with a traceback limit of NFRAME frames -X importtime: show how long each import takes. It shows module name, cumulative time (including nested imports) and self time (excluding nested imports). Note that its output may be broken in multi-threaded application. Typical usage is python3 -X importtime -c 'import asyncio' -X dev: enable CPython's "development mode", introducing additional runtime checks which are too expensive to be enabled by default. It will not be more verbose than the default if the code is correct: new warnings are only emitted when an issue is detected. Effect of the developer mode: * Add default warning filter, as -W default * Install debug hooks on memory allocators: see the PyMem_SetupDebugHooks() C function * Enable the faulthandler module to dump the Python traceback on a crash * Enable asyncio debug mode * Set the dev_mode attribute of sys.flags to True * io.IOBase destructor logs close() exceptions -X utf8: enable UTF-8 mode for operating system interfaces, overriding the default locale-aware mode. -X utf8=0 explicitly disables UTF-8 mode (even when it would otherwise activate automatically). See PYTHONUTF8 for more details -X pycache_prefix=PATH: enable writing .pyc files to a parallel tree rooted at the given directory instead of to the code tree. -X warn_default_encoding: enable opt-in EncodingWarning for 'encoding=None' -X no_debug_ranges: disable the inclusion of the tables mapping extra location information (end line, start column offset and end column offset) to every instruction in code objects. This is useful when smaller code objects and pyc files are desired as well as suppressing the extra visual location indicators when the interpreter displays tracebacks. -X frozen_modules=[on|off]: whether or not frozen modules should be used. The default is "on" (or "off" if you are running a local build). -X int_max_str_digits=number: limit the size of int<->str conversions. This helps avoid denial of service attacks when parsing untrusted data. The default is sys.int_info.default_max_str_digits. 0 disables. -x Skip the first line of the source. This is intended for a DOS specific hack only. Warning: the line numbers in error messages will be off by one! INTERPRETER INTERFACE The interpreter interface resembles that of the UNIX shell: when called with standard input connected to a tty device, it prompts for commands and executes them until an EOF is read; when called with a file name argument or with a file as standard input, it reads and executes a script from that file; when called with -c command, it executes the Python statement(s) given as command. Here command may contain multiple statements separated by newlines. Leading whitespace is significant in Python statements! In non-interactive mode, the entire input is parsed before it is executed. If available, the script name and additional arguments thereafter are passed to the script in the Python variable sys.argv, which is a list of strings (you must first import sys to be able to access it). If no script name is given, sys.argv[0] is an empty string; if -c is used, sys.argv[0] contains the string '-c'. Note that options interpreted by the Python interpreter itself are not placed in sys.argv. In interactive mode, the primary prompt is `>>>'; the second prompt (which appears when a command is not complete) is `...'. The prompts can be changed by assignment to sys.ps1 or sys.ps2. The interpreter quits when it reads an EOF at a prompt. When an unhandled exception occurs, a stack trace is printed and control returns to the primary prompt; in non-interactive mode, the interpreter exits after printing the stack trace. The interrupt signal raises the KeyboardInterrupt exception; other UNIX signals are not caught (except that SIGPIPE is sometimes ignored, in favor of the IOError exception). Error messages are written to stderr. FILES AND DIRECTORIES These are subject to difference depending on local installation conventions; ${prefix} and ${exec_prefix} are installation-dependent and should be interpreted as for GNU software; they may be the same. The default for both is /usr/local. ${exec_prefix}/bin/python Recommended location of the interpreter. ${prefix}/lib/python<version> ${exec_prefix}/lib/python<version> Recommended locations of the directories containing the standard modules. ${prefix}/include/python<version> ${exec_prefix}/include/python<version> Recommended locations of the directories containing the include files needed for developing Python extensions and embedding the interpreter. ENVIRONMENT VARIABLES PYTHONSAFEPATH If this is set to a non-empty string, don't automatically prepend a potentially unsafe path to sys.path such as the current directory, the script's directory or an empty string. See also the -P option. PYTHONHOME Change the location of the standard Python libraries. By default, the libraries are searched in ${prefix}/lib/python<version> and ${exec_prefix}/lib/python<version>, where ${prefix} and ${exec_prefix} are installation-dependent directories, both defaulting to /usr/local. When $PYTHONHOME is set to a single directory, its value replaces both ${prefix} and ${exec_prefix}. To specify different values for these, set $PYTHONHOME to ${prefix}:${exec_prefix}. PYTHONPATH Augments the default search path for module files. The format is the same as the shell's $PATH: one or more directory pathnames separated by colons. Non-existent directories are silently ignored. The default search path is installation dependent, but generally begins with ${prefix}/lib/python<version> (see PYTHONHOME above). The default search path is always appended to $PYTHONPATH. If a script argument is given, the directory containing the script is inserted in the path in front of $PYTHONPATH. The search path can be manipulated from within a Python program as the variable sys.path. PYTHONPLATLIBDIR Override sys.platlibdir. PYTHONSTARTUP If this is the name of a readable file, the Python commands in that file are executed before the first prompt is displayed in interactive mode. The file is executed in the same name space where interactive commands are executed so that objects defined or imported in it can be used without qualification in the interactive session. You can also change the prompts sys.ps1 and sys.ps2 in this file. PYTHONOPTIMIZE If this is set to a non-empty string it is equivalent to specifying the -O option. If set to an integer, it is equivalent to specifying -O multiple times. PYTHONDEBUG If this is set to a non-empty string it is equivalent to specifying the -d option. If set to an integer, it is equivalent to specifying -d multiple times. PYTHONDONTWRITEBYTECODE If this is set to a non-empty string it is equivalent to specifying the -B option (don't try to write .pyc files). PYTHONINSPECT If this is set to a non-empty string it is equivalent to specifying the -i option. PYTHONIOENCODING If this is set before running the interpreter, it overrides the encoding used for stdin/stdout/stderr, in the syntax encodingname:errorhandler The errorhandler part is optional and has the same meaning as in str.encode. For stderr, the errorhandler part is ignored; the handler will always be ´backslashreplace´. PYTHONNOUSERSITE If this is set to a non-empty string it is equivalent to specifying the -s option (Don't add the user site directory to sys.path). PYTHONUNBUFFERED If this is set to a non-empty string it is equivalent to specifying the -u option. PYTHONVERBOSE If this is set to a non-empty string it is equivalent to specifying the -v option. If set to an integer, it is equivalent to specifying -v multiple times. PYTHONWARNINGS If this is set to a comma-separated string it is equivalent to specifying the -W option for each separate value. PYTHONHASHSEED If this variable is set to "random", a random value is used to seed the hashes of str and bytes objects. If PYTHONHASHSEED is set to an integer value, it is used as a fixed seed for generating the hash() of the types covered by the hash randomization. Its purpose is to allow repeatable hashing, such as for selftests for the interpreter itself, or to allow a cluster of python processes to share hash values. The integer must be a decimal number in the range [0,4294967295]. Specifying the value 0 will disable hash randomization. PYTHONINTMAXSTRDIGITS Limit the maximum digit characters in an int value when converting from a string and when converting an int back to a str. A value of 0 disables the limit. Conversions to or from bases 2, 4, 8, 16, and 32 are never limited. PYTHONMALLOC Set the Python memory allocators and/or install debug hooks. The available memory allocators are malloc and pymalloc. The available debug hooks are debug, malloc_debug, and pymalloc_debug. When Python is compiled in debug mode, the default is pymalloc_debug and the debug hooks are automatically used. Otherwise, the default is pymalloc. PYTHONMALLOCSTATS If set to a non-empty string, Python will print statistics of the pymalloc memory allocator every time a new pymalloc object arena is created, and on shutdown. This variable is ignored if the $PYTHONMALLOC environment variable is used to force the malloc(3) allocator of the C library, or if Python is configured without pymalloc support. PYTHONASYNCIODEBUG If this environment variable is set to a non-empty string, enable the debug mode of the asyncio module. PYTHONTRACEMALLOC If this environment variable is set to a non-empty string, start tracing Python memory allocations using the tracemalloc module. The value of the variable is the maximum number of frames stored in a traceback of a trace. For example, PYTHONTRACEMALLOC=1 stores only the most recent frame. PYTHONFAULTHANDLER If this environment variable is set to a non-empty string, faulthandler.enable() is called at startup: install a handler for SIGSEGV, SIGFPE, SIGABRT, SIGBUS and SIGILL signals to dump the Python traceback. This is equivalent to the -X faulthandler option. PYTHONEXECUTABLE If this environment variable is set, sys.argv[0] will be set to its value instead of the value got through the C runtime. Only works on Mac OS X. PYTHONUSERBASE Defines the user base directory, which is used to compute the path of the user site-packages directory and installation paths for python -m pip install --user. PYTHONPROFILEIMPORTTIME If this environment variable is set to a non-empty string, Python will show how long each import takes. This is exactly equivalent to setting -X importtime on the command line. PYTHONBREAKPOINT If this environment variable is set to 0, it disables the default debugger. It can be set to the callable of your debugger of choice. Debug-mode variables Setting these variables only has an effect in a debug build of Python, that is, if Python was configured with the --with-pydebug build option. PYTHONDUMPREFS If this environment variable is set, Python will dump objects and reference counts still alive after shutting down the interpreter. AUTHOR The Python Software Foundation: https://www.python.org/psf/ INTERNET RESOURCES Main website: https://www.python.org/ Documentation: https://docs.python.org/ Developer resources: https://devguide.python.org/ Downloads: https://www.python.org/downloads/ Module repository: https://pypi.org/ Newsgroups: comp.lang.python, comp.lang.python.announce LICENSING Python is distributed under an Open Source license. See the file "LICENSE" in the Python source distribution for information on terms & conditions for accessing and otherwise using Python and for a DISCLAIMER OF ALL WARRANTIES. PYTHON(1)
python - an interpreted, interactive, object-oriented programming language
python [ -B ] [ -b ] [ -d ] [ -E ] [ -h ] [ -i ] [ -I ] [ -m module-name ] [ -q ] [ -O ] [ -OO ] [ -P ] [ -s ] [ -S ] [ -u ] [ -v ] [ -V ] [ -W argument ] [ -x ] [ -X option ] [ -? ] [ --check-hash-based-pycs default | always | never ] [ --help ] [ --help-env ] [ --help-xoptions ] [ --help-all ] [ -c command | script | - ] [ arguments ]
null
null
pydoc3
null
null
null
null
null
rdbg
null
null
null
null
null
jekyll
null
null
null
null
null
irb
irb is the REPL(read-eval-print loop) environment for Ruby programs.
irb – Interactive Ruby Shell
irb [--version] [-dfm] [-I directory] [-r library] [--[no]inspect] [--[no]readline] [--prompt mode] [--prompt-mode mode] [--inf-ruby-mode] [--simple-prompt] [--noprompt] [--tracer] [--back-trace-limit n] [--irb_debug n] [--] [program_file] [argument ...]
--version Prints the version of irb. -E external[:internal] --encoding external[:internal] Same as `ruby -E' . Specifies the default value(s) for external encodings and internal encoding. Values should be separated with colon (:). You can omit the one for internal encodings, then the value (Encoding.default_internal) will be nil. -I path Same as `ruby -I' . Specifies $LOAD_PATH directory -U Same as `ruby -U' . Sets the default value for internal encodings (Encoding.default_internal) to UTF-8. -d Same as `ruby -d' . Sets $DEBUG to true. -f Suppresses read of ~/.irbrc. -h --help Prints a summary of the options. -r library Same as `ruby -r'. Causes irb to load the library using require. --inspect Uses `inspect' for output (default except for bc mode) --noinspect Doesn't use inspect for output --readline Uses Readline extension module. --noreadline Doesn't use Readline extension module. --prompt mode --prompt-mode mode Switch prompt mode. Pre-defined prompt modes are `default', `simple', `xmp' and `inf-ruby'. --inf-ruby-mode Uses prompt appropriate for inf-ruby-mode on emacs. Suppresses --readline. --simple-prompt Makes prompts simple. --noprompt No prompt mode. --tracer Displays trace for each execution of commands. --back-trace-limit n Displays backtrace top n and tail n. The default value is 16. --irb_debug n Sets internal debug level to n (not for popular use) ENVIRONMENT IRBRC Also irb depends on same variables as ruby(1). FILES ~/.irbrc Personal irb initialization.
% irb irb(main):001:0> 1 + 1 2 irb(main):002:0> def t(x) irb(main):003:1> x+1 irb(main):004:1> end => :t irb(main):005:0> t(3) => 4 irb(main):006:0> if t(3) == 4 irb(main):007:1> p :ok irb(main):008:1> end :ok => :ok irb(main):009:0> quit % SEE ALSO ruby(1). REPORTING BUGS • Security vulnerabilities should be reported via an email to security@ruby-lang.org. Reported problems will be published after being fixed. • Other bugs and feature requests can be reported via the Ruby Issue Tracking System (https://bugs.ruby-lang.org/). Do not report security vulnerabilities via this system because it publishes the vulnerabilities immediately. AUTHORS Written by Keiju ISHITSUKA. UNIX April 20, 2017 UNIX
rake
null
null
null
null
null
listen
Creation of socket-based connections requires several operations. First, a socket is created with socket(2). Next, a willingness to accept incoming connections and a queue limit for incoming connections are specified with listen(). Finally, the connections are accepted with accept(2). The listen() call applies only to sockets of type SOCK_STREAM. The backlog parameter defines the maximum length for the queue of pending connections. If a connection request arrives with the queue full, the client may receive an error with an indication of ECONNREFUSED. Alternatively, if the underlying protocol supports retransmission, the request may be ignored so that retries may succeed. RETURN VALUES The listen() function returns the value 0 if successful; otherwise the value -1 is returned and the global variable errno is set to indicate the error. ERRORS listen() will fail if: [EACCES] The current process has insufficient privileges. [EBADF] The argument socket is not a valid file descriptor. [EDESTADDRREQ] The socket is not bound to a local address and the protocol does not support listening on an unbound socket. [EINVAL] socket is already connected. [ENOTSOCK] The argument socket does not reference a socket. [EOPNOTSUPP] The socket is not of a type that supports the operation listen(). SEE ALSO accept(2), connect(2), connectx(2), socket(2) BUGS The backlog is currently limited (silently) to 128. HISTORY The listen() function call appeared in 4.2BSD. BSD 4.2 March 18, 2015 BSD 4.2
listen – listen for connections on a socket
#include <sys/socket.h> int listen(int socket, int backlog);
null
null
bundle
Bundler manages an application´s dependencies through its entire life across many machines systematically and repeatably. See the bundler website http://bundler.io for information on getting started, and Gemfile(5) for more information on the Gemfile format.
bundle - Ruby Dependency Management
bundle COMMAND [--no-color] [--verbose] [ARGS]
--no-color Print all output without color --retry, -r Specify the number of times you wish to attempt network commands --verbose, -V Print out additional logging information BUNDLE COMMANDS We divide bundle subcommands into primary commands and utilities: PRIMARY COMMANDS bundle install(1) bundle-install.1.html Install the gems specified by the Gemfile or Gemfile.lock bundle update(1) bundle-update.1.html Update dependencies to their latest versions bundle package(1) bundle-package.1.html Package the .gem files required by your application into the vendor/cache directory bundle exec(1) bundle-exec.1.html Execute a script in the current bundle bundle config(1) bundle-config.1.html Specify and read configuration options for Bundler bundle help(1) Display detailed help for each subcommand UTILITIES bundle add(1) bundle-add.1.html Add the named gem to the Gemfile and run bundle install bundle binstubs(1) bundle-binstubs.1.html Generate binstubs for executables in a gem bundle check(1) bundle-check.1.html Determine whether the requirements for your application are installed and available to Bundler bundle show(1) bundle-show.1.html Show the source location of a particular gem in the bundle bundle outdated(1) bundle-outdated.1.html Show all of the outdated gems in the current bundle bundle console(1) Start an IRB session in the current bundle bundle open(1) bundle-open.1.html Open an installed gem in the editor bundle lock(1) bundle-lock.1.hmtl Generate a lockfile for your dependencies bundle viz(1) bundle-viz.1.html Generate a visual representation of your dependencies bundle init(1) bundle-init.1.html Generate a simple Gemfile, placed in the current directory bundle gem(1) bundle-gem.1.html Create a simple gem, suitable for development with Bundler bundle platform(1) bundle-platform.1.html Display platform compatibility information bundle clean(1) bundle-clean.1.html Clean up unused gems in your Bundler directory bundle doctor(1) bundle-doctor.1.html Display warnings about common problems PLUGINS When running a command that isn´t listed in PRIMARY COMMANDS or UTILITIES, Bundler will try to find an executable on your path named bundler-<command> and execute it, passing down any extra arguments to it. OBSOLETE These commands are obsolete and should no longer be used: • bundle cache(1) • bundle show(1) November 2018 BUNDLE(1)
null
ri
ri is a command-line front end for the Ruby API reference. You can search and read the API reference for classes and methods with ri. ri is a part of Ruby. name can be: Class | Module | Module::Class Class::method | Class#method | Class.method | method gem_name: | gem_name:README | gem_name:History All class names may be abbreviated to their minimum unambiguous form. If a name is ambiguous, all valid options will be listed. A ‘.’ matches either class or instance methods, while #method matches only instance and ::method matches only class methods. README and other files may be displayed by prefixing them with the gem name they're contained in. If the gem name is followed by a ‘:’ all files in the gem will be shown. The file name extension may be omitted where it is unambiguous. For example: ri Fil ri File ri File.new ri zip ri rdoc:README Note that shell quoting or escaping may be required for method names containing punctuation: ri 'Array.[]' ri compact\! To see the default directories ri will search, run: ri --list-doc-dirs Specifying the --system, --site, --home, --gems, or --doc-dir options will limit ri to searching only the specified directories. ri options may be set in the RI environment variable. The ri pager can be set with the RI_PAGER environment variable or the PAGER environment variable.
ri – Ruby API reference front end
ri [-ahilTv] [-d DIRNAME] [-f FORMAT] [-w WIDTH] [--[no-]pager] [--server[=PORT]] [--[no-]list-doc-dirs] [--no-standard-docs] [--[no-]{system|site|gems|home}] [--[no-]profile] [--dump=CACHE] [name ...]
-i --[no-]interactive In interactive mode you can repeatedly look up methods with autocomplete. -a --[no-]all Show all documentation for a class or module. -l --[no-]list List classes ri knows about. --[no-]pager Send output to a pager, rather than directly to stdout. -T Synonym for --no-pager. -w WIDTH --width=WIDTH Set the width of the output. --server[=PORT] Run RDoc server on the given port. The default port is 8214. -f FORMAT --format=FORMAT Use the selected formatter. The default formatter is bs for paged output and ansi otherwise. Valid formatters are: ansi, bs, markdown, rdoc. -h --help Show help and exit. -v --version Output version information and exit. Data source options: --[no-]list-doc-dirs List the directories from which ri will source documentation on stdout and exit. -d DIRNAME --doc-dir=DIRNAME List of directories from which to source documentation in addition to the standard directories. May be repeated. --no-standard-docs Do not include documentation from the Ruby standard library, site_lib, installed gems, or ~/.rdoc. Use with --doc-dir. --[no-]system Include documentation from Ruby's standard library. Defaults to true. --[no-]site Include documentation from libraries installed in site_lib. Defaults to true. --[no-]gems Include documentation from RubyGems. Defaults to true. --[no-]home Include documentation stored in ~/.rdoc. Defaults to true. Debug options: --[no-]profile Run with the Ruby profiler. --dump=CACHE Dump data from an ri cache or data file. ENVIRONMENT RI Options to prepend to those specified on the command-line. RI_PAGER PAGER Pager program to use for displaying. HOME USERPROFILE HOMEPATH Path to the user's home directory. FILES ~/.rdoc Path for ri data in the user's home directory. SEE ALSO ruby(1), rdoc(1), gem(1) REPORTING BUGS • Security vulnerabilities should be reported via an email to security@ruby-lang.org. Reported problems will be published after being fixed. • Other bugs and feature requests can be reported via the Ruby Issue Tracking System (https://bugs.ruby-lang.org/). Do not report security vulnerabilities via this system because it publishes the vulnerabilities immediately. AUTHORS Written by Dave Thomas ⟨dave@pragmaticprogrammer.com⟩. UNIX April 20, 2017 UNIX
null
rbs
null
null
null
null
null
racc
null
null
null
null
null
kramdown
null
null
null
null
null
safe_yaml
null
null
null
null
null
rougify
null
null
null
null
null
erb
erb is a command line front-end for ERB library, which is an implementation of eRuby. ERB provides an easy to use but powerful templating system for Ruby. Using ERB, actual Ruby code can be added to any plain text document for the purposes of generating document information details and/or flow control. erb is a part of Ruby.
erb – Ruby Templating
erb [--version] [-UPdnvx] [-E ext[:int]] [-S level] [-T mode] [-r library] [--] [file ...]
--version Prints the version of erb. -E external[:internal] --encoding external[:internal] Specifies the default value(s) for external encodings and internal encoding. Values should be separated with colon (:). You can omit the one for internal encodings, then the value (Encoding.default_internal) will be nil. -P Disables ruby code evaluation for lines beginning with %. -S level Specifies the safe level in which eRuby script will run. -T mode Specifies trim mode (default 0). mode can be one of 0 EOL remains after the embedded ruby script is evaluated. 1 EOL is removed if the line ends with %>. 2 EOL is removed if the line starts with <% and ends with %>. - EOL is removed if the line ends with -%>. And leading whitespaces are removed if the erb directive starts with <%-. -r Load a library -U can be one of Sets the default value for internal encodings (Encoding.default_internal) to UTF-8. -d --debug Turns on debug mode. $DEBUG will be set to true. -h --help Prints a summary of the options. -n Used with -x. Prepends the line number to each line in the output. -v Enables verbose mode. $VERBOSE will be set to true. -x Converts the eRuby script into Ruby script and prints it without line numbers.
Here is an eRuby script <?xml version="1.0" ?> <% require 'prime' -%> <erb-example> <calc><%= 1+1 %></calc> <var><%= __FILE__ %></var> <library><%= Prime.each(10).to_a.join(", ") %></library> </erb-example> Command % erb -T - example.erb prints <?xml version="1.0" ?> <erb-example> <calc>2</calc> <var>example.erb</var> <library>2, 3, 5, 7</library> </erb-example> SEE ALSO ruby(1). And see ri(1) documentation for ERB class. REPORTING BUGS • Security vulnerabilities should be reported via an email to security@ruby-lang.org. Reported problems will be published after being fixed. • Other bugs and feature requests can be reported via the Ruby Issue Tracking System (https://bugs.ruby-lang.org/). Do not report security vulnerabilities via this system because it publishes the vulnerabilities immediately. AUTHORS Written by Masatoshi SEKI. UNIX December 16, 2018 UNIX
sass
null
null
null
null
null
rdoc
null
null
null
null
null
typeprof
null
null
null
null
null
bundler
null
null
null
null
null
ruby
Ruby is an interpreted scripting language for quick and easy object- oriented programming. It has many features to process text files and to do system management tasks (like in Perl). It is simple, straight- forward, and extensible. If you want a language for easy object-oriented programming, or you don't like the Perl ugliness, or you do like the concept of LISP, but don't like too many parentheses, Ruby might be your language of choice. FEATURES Ruby's features are as follows: Interpretive Ruby is an interpreted language, so you don't have to recompile programs written in Ruby to execute them. Variables have no type (dynamic typing) Variables in Ruby can contain data of any type. You don't have to worry about variable typing. Consequently, it has a weaker compile time check. No declaration needed You can use variables in your Ruby programs without any declarations. Variable names denote their scope - global, class, instance, or local. Simple syntax Ruby has a simple syntax influenced slightly from Eiffel. No user-level memory management Ruby has automatic memory management. Objects no longer referenced from anywhere are automatically collected by the garbage collector built into the interpreter. Everything is an object Ruby is a purely object-oriented language, and was so since its creation. Even such basic data as integers are seen as objects. Class, inheritance, and methods Being an object-oriented language, Ruby naturally has basic features like classes, inheritance, and methods. Singleton methods Ruby has the ability to define methods for certain objects. For example, you can define a press-button action for certain widget by defining a singleton method for the button. Or, you can make up your own prototype based object system using singleton methods, if you want to. Mix-in by modules Ruby intentionally does not have the multiple inheritance as it is a source of confusion. Instead, Ruby has the ability to share implementations across the inheritance tree. This is often called a ‘Mix-in’. Iterators Ruby has iterators for loop abstraction. Closures In Ruby, you can objectify the procedure. Text processing and regular expressions Ruby has a bunch of text processing features like in Perl. M17N, character set independent Ruby supports multilingualized programming. Easy to process texts written in many different natural languages and encoded in many different character encodings, without dependence on Unicode. Bignums With built-in bignums, you can for example calculate factorial(400). Reflection and domain specific languages Class is also an instance of the Class class. Definition of classes and methods is an expression just as 1+1 is. So your programs can even write and modify programs. Thus you can write your application in your own programming language on top of Ruby. Exception handling As in Java(tm). Direct access to the OS Ruby can use most UNIX system calls, often used in system programming. Dynamic loading On most UNIX systems, you can load object files into the Ruby interpreter on-the-fly. Rich libraries In addition to the “builtin libraries” and “standard libraries” that are bundled with Ruby, a vast amount of third-party libraries (“gems”) are available via the package management system called ‘RubyGems’, namely the gem(1) command. Visit RubyGems.org (https://rubygems.org/) to find the gems you need, and explore GitHub (https://github.com/) to see how they are being developed and used.
ruby – Interpreted object-oriented scripting language
ruby [--copyright] [--version] [-SUacdlnpswvy] [-0[octal]] [-C directory] [-E external[:internal]] [-F[pattern]] [-I directory] [-K[c]] [-T[level]] [-W[level]] [-e command] [-i[extension]] [-r library] [-x[directory]] [--{enable|disable}-FEATURE] [--dump=target] [--verbose] [--] [program_file] [argument ...]
The Ruby interpreter accepts the following command-line options (switches). They are quite similar to those of perl(1). --copyright Prints the copyright notice, and quits immediately without running any script. --version Prints the version of the Ruby interpreter, and quits immediately without running any script. -0[octal] (The digit “zero”.) Specifies the input record separator ($/) as an octal number. If no digit is given, the null character is taken as the separator. Other switches may follow the digits. -00 turns Ruby into paragraph mode. -0777 makes Ruby read whole file at once as a single string since there is no legal character with that value. -C directory -X directory Causes Ruby to switch to the directory. -E external[:internal] --encoding external[:internal] Specifies the default value(s) for external encodings and internal encoding. Values should be separated with colon (:). You can omit the one for internal encodings, then the value (Encoding.default_internal) will be nil. --external-encoding=encoding --internal-encoding=encoding Specify the default external or internal character encoding -F pattern Specifies input field separator ($;). -I directory Used to tell Ruby where to load the library scripts. Directory path will be added to the load-path variable ($:). -K kcode Specifies KANJI (Japanese) encoding. The default value for script encodings (__ENCODING__) and external encodings (Encoding.default_external) will be the specified one. kcode can be one of e EUC-JP s Windows-31J (CP932) u UTF-8 n ASCII-8BIT (BINARY) -S Makes Ruby use the PATH environment variable to search for script, unless its name begins with a slash. This is used to emulate #! on machines that don't support it, in the following manner: #! /usr/local/bin/ruby # This line makes the next one a comment in Ruby \ exec /usr/local/bin/ruby -S $0 $* On some systems $0 does not always contain the full pathname, so you need the -S switch to tell Ruby to search for the script if necessary (to handle embedded spaces and such). A better construct than $* would be ${1+"$@"}, but it does not work if the script is being interpreted by csh(1). -T[level=1] Turns on taint checks at the specified level (default 1). -U Sets the default value for internal encodings (Encoding.default_internal) to UTF-8. -W[level=2] Turns on verbose mode at the specified level without printing the version message at the beginning. The level can be; 0 Verbose mode is "silence". It sets the $VERBOSE to nil. 1 Verbose mode is "medium". It sets the $VERBOSE to false. 2 (default) Verbose mode is "verbose". It sets the $VERBOSE to true. -W2 is same as -w -a Turns on auto-split mode when used with -n or -p. In auto-split mode, Ruby executes $F = $_.split at beginning of each loop. -c Causes Ruby to check the syntax of the script and exit without executing. If there are no syntax errors, Ruby will print “Syntax OK” to the standard output. -d --debug Turns on debug mode. $DEBUG will be set to true. -e command Specifies script from command-line while telling Ruby not to search the rest of the arguments for a script file name. -h --help Prints a summary of the options. -i extension Specifies in-place-edit mode. The extension, if specified, is added to old file name to make a backup copy. For example: % echo matz > /tmp/junk % cat /tmp/junk matz % ruby -p -i.bak -e '$_.upcase!' /tmp/junk % cat /tmp/junk MATZ % cat /tmp/junk.bak matz -l (The lowercase letter “ell”.) Enables automatic line- ending processing, which means to firstly set $\ to the value of $/, and secondly chops every line read using chop!. -n Causes Ruby to assume the following loop around your script, which makes it iterate over file name arguments somewhat like sed -n or awk. while gets ... end -p Acts mostly same as -n switch, but print the value of variable $_ at the each end of the loop. For example: % echo matz | ruby -p -e '$_.tr! "a-z", "A-Z"' MATZ -r library Causes Ruby to load the library using require. It is useful when using -n or -p. -s Enables some switch parsing for switches after script name but before any file name arguments (or before a --). Any switches found there are removed from ARGV and set the corresponding variable in the script. For example: #! /usr/local/bin/ruby -s # prints "true" if invoked with `-xyz' switch. print "true\n" if $xyz -v Enables verbose mode. Ruby will print its version at the beginning and set the variable $VERBOSE to true. Some methods print extra messages if this variable is true. If this switch is given, and no other switches are present, Ruby quits after printing its version. -w Enables verbose mode without printing version message at the beginning. It sets the $VERBOSE variable to true. -x[directory] Tells Ruby that the script is embedded in a message. Leading garbage will be discarded until the first line that starts with “#!” and contains the string, “ruby”. Any meaningful switches on that line will be applied. The end of the script must be specified with either EOF, ^D (control-D), ^Z (control-Z), or the reserved word __END__. If the directory name is specified, Ruby will switch to that directory before executing script. -y --yydebug DO NOT USE. Turns on compiler debug mode. Ruby will print a bunch of internal state messages during compilation. Only specify this switch you are going to debug the Ruby interpreter. --disable-FEATURE --enable-FEATURE Disables (or enables) the specified FEATURE. --disable-gems --enable-gems Disables (or enables) RubyGems libraries. By default, Ruby will load the latest version of each installed gem. The Gem constant is true if RubyGems is enabled, false if otherwise. --disable-rubyopt --enable-rubyopt Ignores (or considers) the RUBYOPT environment variable. By default, Ruby considers the variable. --disable-all --enable-all Disables (or enables) all features. --dump=target Dump some informations. Prints the specified target. target can be one of; version version description same as --version usage brief usage message same as -h help Show long help message same as --help syntax check of syntax same as -c --yydebug yydebug compiler debug mode, same as --yydebug Only specify this switch if you are going to debug the Ruby interpreter. parsetree parsetree_with_comment AST nodes tree Only specify this switch if you are going to debug the Ruby interpreter. insns disassembled instructions Only specify this switch if you are going to debug the Ruby interpreter. --verbose Enables verbose mode without printing version message at the beginning. It sets the $VERBOSE variable to true. If this switch is given, and no script arguments (script file or -e options) are present, Ruby quits immediately. ENVIRONMENT RUBYLIB A colon-separated list of directories that are added to Ruby's library load path ($:). Directories from this environment variable are searched before the standard load path is searched. e.g.: RUBYLIB="$HOME/lib/ruby:$HOME/lib/rubyext" RUBYOPT Additional Ruby options. e.g. RUBYOPT="-w -Ke" Note that RUBYOPT can contain only -d, -E, -I, -K, -r, -T, -U, -v, -w, -W, --debug, --disable-FEATURE and --enable-FEATURE. RUBYPATH A colon-separated list of directories that Ruby searches for Ruby programs when the -S flag is specified. This variable precedes the PATH environment variable. RUBYSHELL The path to the system shell command. This environment variable is enabled for only mswin32, mingw32, and OS/2 platforms. If this variable is not defined, Ruby refers to COMSPEC. PATH Ruby refers to the PATH environment variable on calling Kernel#system. And Ruby depends on some RubyGems related environment variables unless RubyGems is disabled. See the help of gem(1) as below. % gem help GC ENVIRONMENT The Ruby garbage collector (GC) tracks objects in fixed-sized slots, but each object may have auxiliary memory allocations handled by the malloc family of C standard library calls ( malloc(3), calloc(3), and realloc(3)). In this documentatation, the "heap" refers to the Ruby object heap of fixed-sized slots, while "malloc" refers to auxiliary allocations commonly referred to as the "process heap". Thus there are at least two possible ways to trigger GC: 1 Reaching the object limit. 2 Reaching the malloc limit. In Ruby 2.1, the generational GC was introduced and the limits are divided into young and old generations, providing two additional ways to trigger a GC: 3 Reaching the old object limit. 4 Reaching the old malloc limit. There are currently 4 possible areas where the GC may be tuned by the following 11 environment variables: RUBY_GC_HEAP_INIT_SLOTS Initial allocation slots. Introduced in Ruby 2.1, default: 10000. RUBY_GC_HEAP_FREE_SLOTS Prepare at least this amount of slots after GC. Allocate this number slots if there are not enough slots. Introduced in Ruby 2.1, default: 4096 RUBY_GC_HEAP_GROWTH_FACTOR Increase allocation rate of heap slots by this factor. Introduced in Ruby 2.1, default: 1.8, minimum: 1.0 (no growth) RUBY_GC_HEAP_GROWTH_MAX_SLOTS Allocation rate is limited to this number of slots, preventing excessive allocation due to RUBY_GC_HEAP_GROWTH_FACTOR. Introduced in Ruby 2.1, default: 0 (no limit) RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR Perform a full GC when the number of old objects is more than R * N, where R is this factor and N is the number of old objects after the last full GC. Introduced in Ruby 2.1.1, default: 2.0 RUBY_GC_MALLOC_LIMIT The initial limit of young generation allocation from the malloc-family. GC will start when this limit is reached. Default: 16MB RUBY_GC_MALLOC_LIMIT_MAX The maximum limit of young generation allocation from malloc before GC starts. Prevents excessive malloc growth due to RUBY_GC_MALLOC_LIMIT_GROWTH_FACTOR. Introduced in Ruby 2.1, default: 32MB. RUBY_GC_MALLOC_LIMIT_GROWTH_FACTOR Increases the limit of young generation malloc calls, reducing GC frequency but increasing malloc growth until RUBY_GC_MALLOC_LIMIT_MAX is reached. Introduced in Ruby 2.1, default: 1.4, minimum: 1.0 (no growth) RUBY_GC_OLDMALLOC_LIMIT The initial limit of old generation allocation from malloc, a full GC will start when this limit is reached. Introduced in Ruby 2.1, default: 16MB RUBY_GC_OLDMALLOC_LIMIT_MAX The maximum limit of old generation allocation from malloc before a full GC starts. Prevents excessive malloc growth due to RUBY_GC_OLDMALLOC_LIMIT_GROWTH_FACTOR. Introduced in Ruby 2.1, default: 128MB RUBY_GC_OLDMALLOC_LIMIT_GROWTH_FACTOR Increases the limit of old generation malloc allocation, reducing full GC frequency but increasing malloc growth until RUBY_GC_OLDMALLOC_LIMIT_MAX is reached. Introduced in Ruby 2.1, default: 1.2, minimum: 1.0 (no growth) STACK SIZE ENVIRONMENT Stack size environment variables are implementation-dependent and subject to change with different versions of Ruby. The VM stack is used for pure-Ruby code and managed by the virtual machine. Machine stack is used by the operating system and its usage is dependent on C extensions as well as C compiler options. Using lower values for these may allow applications to keep more Fibers or Threads running; but increases the chance of SystemStackError exceptions and segmentation faults (SIGSEGV). These environment variables are available since Ruby 2.0.0. All values are specified in bytes. RUBY_THREAD_VM_STACK_SIZE VM stack size used at thread creation. default: 131072 (32-bit CPU) or 262144 (64-bit) RUBY_THREAD_MACHINE_STACK_SIZE Machine stack size used at thread creation. default: 524288 or 1048575 RUBY_FIBER_VM_STACK_SIZE VM stack size used at fiber creation. default: 65536 or 131072 RUBY_FIBER_MACHINE_STACK_SIZE Machine stack size used at fiber creation. default: 262144 or 524288 SEE ALSO https://www.ruby-lang.org/ The official web site. https://www.ruby-toolbox.com/ Comprehensive catalog of Ruby libraries. REPORTING BUGS • Security vulnerabilities should be reported via an email to security@ruby-lang.org. Reported problems will be published after being fixed. • Other bugs and feature requests can be reported via the Ruby Issue Tracking System (https://bugs.ruby-lang.org/). Do not report security vulnerabilities via this system because it publishes the vulnerabilities immediately. AUTHORS Ruby is designed and implemented by Yukihiro Matsumoto ⟨matz@netlab.jp⟩. See ⟨https://bugs.ruby-lang.org/projects/ruby/wiki/Contributors⟩ for contributors to Ruby. UNIX April 14, 2018 UNIX
null
gem
RubyGems is a sophisticated package manager for the Ruby programming language. On OS X the default bindir for gems that install binaries is /Library/Ruby/bin. For more information about it, you can use its --help flag. There is also online documentation available at "http://docs.rubygems.org". SEE ALSO ruby(1) AUTHORS RubyGems was originally developed at RubyConf 2003 by Rich Kilmer, Chad Fowler, David Black, Paul Brannan and Jim Weirch, and has received a lot of contributions since then. You can obtain the RubyGems sources at http://rubyforge.org/projects/rubygems/. macOS 14.5 February 6, 2013 macOS 14.5
gem – RubyGems program
gem command [arguments...] [options...]
null
null
node
Node.js is a set of libraries for JavaScript which allows it to be used outside of the browser. It is primarily focused on creating simple, easy-to-build network clients and servers. Execute node without arguments to start a REPL.
node – server-side JavaScript runtime
node [options] [v8-options] [-e string | script.js | -] [--] [arguments ...] node inspect [-e string | script.js | - | <host>:<port>] ... node [--v8-options]
- Alias for stdin, analogous to the use of - in other command-line utilities. The executed script is read from stdin, and remaining arguments are passed to the script. -- Indicate the end of command-line options. Pass the rest of the arguments to the script. If no script filename or eval/print script is supplied prior to this, then the next argument will be used as a script filename. --abort-on-uncaught-exception Aborting instead of exiting causes a core file to be generated for analysis. --allow-fs-read Allow file system read access when using the permission model. --allow-fs-write Allow file system write access when using the permission model. --allow-addons Allow using native addons when using the permission model. --allow-child-process Allow spawning process when using the permission model. --allow-wasi Allow execution of WASI when using the permission model. --allow-worker Allow creating worker threads when using the permission model. --completion-bash Print source-able bash completion script for Node.js. -C, --conditions string Use custom conditional exports conditions. string --cpu-prof Start the V8 CPU profiler on start up, and write the CPU profile to disk before exit. If --cpu-prof-dir is not specified, the profile will be written to the current working directory with a generated file name. --cpu-prof-dir The directory where the CPU profiles generated by --cpu-prof will be placed. The default value is controlled by the --diagnostic-dir. command-line option. --cpu-prof-interval The sampling interval in microseconds for the CPU profiles generated by --cpu-prof. The default is 1000. --cpu-prof-name File name of the V8 CPU profile generated with --cpu-prof. --diagnostic-dir Set the directory for all diagnostic output files. Default is current working directory. Set the directory to which all diagnostic output files will be written to. Defaults to current working directory. Affects the default output directory of: --cpu-prof-dir. --heap-prof-dir. --redirect-warnings. --disable-proto=mode Disable the `Object.prototype.__proto__` property. If mode is `delete`, the property will be removed entirely. If mode is `throw`, accesses to the property will throw an exception with the code `ERR_PROTO_ACCESS`. --disable-wasm-trap-handler=mode Disable trap-handler-based WebAssembly bound checks and fall back to inline bound checks so that WebAssembly can be run with limited virtual memory. --disallow-code-generation-from-strings Make built-in language features like `eval` and `new Function` that generate code from strings throw an exception instead. This does not affect the Node.js `vm` module. --enable-fips Enable FIPS-compliant crypto at startup. Requires Node.js to be built with ./configure --openssl-fips. --enable-source-maps Enable Source Map V3 support for stack traces. --experimental-default-type=type Interpret as either ES modules or CommonJS modules input via --eval or STDIN, when --input-type is unspecified; --experimental-global-webcrypto Expose the Web Crypto API on the global scope. --experimental-import-meta-resolve Enable experimental ES modules support for import.meta.resolve(). --experimental-loader=module Specify the module to use as a custom module loader. --experimental-network-imports Enable experimental support for loading modules using `import` over `https:`. --experimental-permission Enable the experimental permission model. --experimental-policy Use the specified file as a security policy. --experimental-shadow-realm Use this flag to enable ShadowRealm support. --experimental-test-coverage Enable code coverage in the test runner. --experimental-websocket Enable experimental support for the WebSocket API. --no-experimental-fetch Disable experimental support for the Fetch API. --no-experimental-global-customevent Disable exposition of the CustomEvent on the global scope. --no-experimental-global-webcrypto Disable exposition of the Web Crypto API on the global scope. --no-experimental-repl-await Disable top-level await keyword support in REPL. --experimental-vm-modules Enable experimental ES module support in VM module. --experimental-wasi-unstable-preview1 Enable experimental WebAssembly System Interface support. This flag is no longer required as WASI is enabled by default. --experimental-wasm-modules Enable experimental WebAssembly module support. --force-context-aware Disable loading native addons that are not context-aware. --force-fips Force FIPS-compliant crypto on startup (Cannot be disabled from script code). Same requirements as --enable-fips. --frozen-intrinsics Enable experimental frozen intrinsics support. --heapsnapshot-near-heap-limit=max_count Generate heap snapshot when the V8 heap usage is approaching the heap limit. No more than the specified number of snapshots will be generated. --heapsnapshot-signal=signal Generate heap snapshot on specified signal. --heap-prof Start the V8 heap profiler on start up, and write the heap profile to disk before exit. If --heap-prof-dir is not specified, the profile will be written to the current working directory with a generated file name. --heap-prof-dir The directory where the heap profiles generated by --heap-prof will be placed. The default value is controlled by the --diagnostic-dir. command-line option. --heap-prof-interval The average sampling interval in bytes for the heap profiles generated by --heap-prof. The default is 512 * 1024. --heap-prof-name File name of the V8 heap profile generated with --heap-prof. --icu-data-dir=file Specify ICU data load path. Overrides NODE_ICU_DATA. --input-type=type Set the module resolution type for input via --eval, --print or STDIN. --inspect-brk=[host:]port Activate inspector on host:port and break at start of user script. --inspect-port=[host:]port Set the host:port to be used when the inspector is activated. --inspect-publish-uid=stderr,http Specify how the inspector WebSocket URL is exposed. Valid values are stderr and http. Default is stderr,http. --inspect-wait=[host:]port Activate inspector on host:port and wait for debugger to be attached. --inspect=[host:]port Activate inspector on host:port. Default is 127.0.0.1:9229. V8 Inspector integration allows attaching Chrome DevTools and IDEs to Node.js instances for debugging and profiling. It uses the Chrome DevTools Protocol. --insecure-http-parser Use an insecure HTTP parser that accepts invalid HTTP headers. This may allow interoperability with non-conformant HTTP implementations. It may also allow request smuggling and other HTTP attacks that rely on invalid headers being accepted. Avoid using this option. --jitless Disable runtime allocation of executable memory. This may be required on some platforms for security reasons. It can also reduce attack surface on other platforms, but the performance impact may be severe. This flag is inherited from V8 and is subject to change upstream. It may disappear in a non-semver-major release. --max-http-header-size=size Specify the maximum size of HTTP headers in bytes. Defaults to 16 KiB. --napi-modules This option is a no-op. It is kept for compatibility. --no-deprecation Silence deprecation warnings. --no-extra-info-on-fatal-exception Hide extra information on fatal exception that causes exit. --no-force-async-hooks-checks Disable runtime checks for `async_hooks`. These will still be enabled dynamically when `async_hooks` is enabled. --no-addons Disable the `node-addons` exports condition as well as disable loading native addons. When `--no-addons` is specified, calling `process.dlopen` or requiring a native C++ addon will fail and throw an exception. --no-global-search-paths Do not search modules from global paths. --no-warnings Silence all process warnings (including deprecations). --node-memory-debug Enable extra debug checks for memory leaks in Node.js internals. This is usually only useful for developers debugging Node.js itself. --openssl-config=file Load an OpenSSL configuration file on startup. Among other uses, this can be used to enable FIPS-compliant crypto if Node.js is built with ./configure --openssl-fips. --pending-deprecation Emit pending deprecation warnings. --policy-integrity=sri Instructs Node.js to error prior to running any code if the policy does not have the specified integrity. It expects a Subresource Integrity string as a parameter. --preserve-symlinks Instructs the module loader to preserve symbolic links when resolving and caching modules other than the main module. --preserve-symlinks-main Instructs the module loader to preserve symbolic links when resolving and caching the main module. --prof Generate V8 profiler output. --prof-process Process V8 profiler output generated using the V8 option --prof. --redirect-warnings=file Write process warnings to the given file instead of printing to stderr. --report-compact Write diagnostic reports in a compact format, single-line JSON. --report-dir --report-directory Location at which the diagnostic report will be generated. The `file` name may be an absolute path. If it is not, the default directory it will be written to is controlled by the --diagnostic-dir. command-line option. --report-filename Name of the file to which the diagnostic report will be written. --report-on-fatalerror Enables the diagnostic report to be triggered on fatal errors (internal errors within the Node.js runtime such as out of memory) that leads to termination of the application. Useful to inspect various diagnostic data elements such as heap, stack, event loop state, resource consumption etc. to reason about the fatal error. --report-on-signal Enables diagnostic report to be generated upon receiving the specified (or predefined) signal to the running Node.js process. Default signal is SIGUSR2. --report-signal Sets or resets the signal for diagnostic report generation (not supported on Windows). Default signal is SIGUSR2. --report-uncaught-exception Enables diagnostic report to be generated on un-caught exceptions. Useful when inspecting JavaScript stack in conjunction with native stack and other runtime environment data. --secure-heap=n Specify the size of the OpenSSL secure heap. Any value less than 2 disables the secure heap. The default is 0. The value must be a power of two. --secure-heap-min=n Specify the minimum allocation from the OpenSSL secure heap. The default is 2. The value must be a power of two. --test Starts the Node.js command line test runner. --test-concurrency The maximum number of test files that the test runner CLI will execute concurrently. --test-force-exit Configures the test runner to exit the process once all known tests have finished executing even if the event loop would otherwise remain active. --test-name-pattern A regular expression that configures the test runner to only execute tests whose name matches the provided pattern. --test-reporter A test reporter to use when running tests. --test-reporter-destination The destination for the corresponding test reporter. --test-only Configures the test runner to only execute top level tests that have the `only` option set. --test-shard Test suite shard to execute in a format of <index>/<total>. --test-timeout A number of milliseconds the test execution will fail after. --throw-deprecation Throw errors for deprecations. --title=title Specify process.title on startup. --tls-cipher-list=list Specify an alternative default TLS cipher list. Requires Node.js to be built with crypto support. (Default) --tls-keylog=file Log TLS key material to a file. The key material is in NSS SSLKEYLOGFILE format and can be used by software (such as Wireshark) to decrypt the TLS traffic. --tls-max-v1.2 Set default maxVersion to 'TLSv1.2'. Use to disable support for TLSv1.3. --tls-max-v1.3 Set default maxVersion to 'TLSv1.3'. Use to enable support for TLSv1.3. --tls-min-v1.0 Set default minVersion to 'TLSv1'. Use for compatibility with old TLS clients or servers. --tls-min-v1.1 Set default minVersion to 'TLSv1.1'. Use for compatibility with old TLS clients or servers. --tls-min-v1.2 Set default minVersion to 'TLSv1.2'. This is the default for 12.x and later, but the option is supported for compatibility with older Node.js versions. --tls-min-v1.3 Set default minVersion to 'TLSv1.3'. Use to disable support for TLSv1.2 in favour of TLSv1.3, which is more secure. --trace-atomics-wait Print short summaries of calls to Atomics.wait(). This flag is deprecated. --trace-deprecation Print stack traces for deprecations. --trace-event-categories categories A comma-separated list of categories that should be traced when trace event tracing is enabled using --trace-events-enabled. --trace-event-file-pattern pattern Template string specifying the filepath for the trace event data, it supports ${rotation} and ${pid}. --trace-events-enabled Enable the collection of trace event tracing information. --trace-exit Prints a stack trace whenever an environment is exited proactively, i.e. invoking `process.exit()`. --trace-sigint Prints a stack trace on SIGINT. --trace-sync-io Print a stack trace whenever synchronous I/O is detected after the first turn of the event loop. --trace-tls Prints TLS packet trace information to stderr. --trace-uncaught Print stack traces for uncaught exceptions; usually, the stack trace associated with the creation of an Error is printed, whereas this makes Node.js also print the stack trace associated with throwing the value (which does not need to be an Error instance). Enabling this option may affect garbage collection behavior negatively. --trace-warnings Print stack traces for process warnings (including deprecations). --track-heap-objects Track heap object allocations for heap snapshots. --unhandled-rejections=mode Define the behavior for unhandled rejections. Can be one of `strict` (raise an error), `warn` (enforce warnings) or `none` (silence warnings). --use-bundled-ca, --use-openssl-ca Use bundled Mozilla CA store as supplied by current Node.js version or use OpenSSL's default CA store. The default store is selectable at build-time. The bundled CA store, as supplied by Node.js, is a snapshot of Mozilla CA store that is fixed at release time. It is identical on all supported platforms. Using OpenSSL store allows for external modifications of the store. For most Linux and BSD distributions, this store is maintained by the distribution maintainers and system administrators. OpenSSL CA store location is dependent on configuration of the OpenSSL library but this can be altered at runtime using environment variables. See SSL_CERT_DIR and SSL_CERT_FILE. --use-largepages=mode Re-map the Node.js static code to large memory pages at startup. If supported on the target system, this will cause the Node.js static code to be moved onto 2 MiB pages instead of 4 KiB pages. mode must have one of the following values: `off` (the default value, meaning do not map), `on` (map and ignore failure, reporting it to stderr), or `silent` (map and silently ignore failure). --v8-options Print V8 command-line options. --v8-pool-size=num Set V8's thread pool size which will be used to allocate background jobs. If set to 0 then V8 will choose an appropriate size of the thread pool based on the number of online processors. If the value provided is larger than V8's maximum, then the largest value will be chosen. --zero-fill-buffers Automatically zero-fills all newly allocated Buffer and SlowBuffer instances. -c, --check Check the script's syntax without executing it. Exits with an error code if script is invalid. -e, --eval string Evaluate string as JavaScript. -h, --help Print command-line options. The output of this option is less detailed than this document. -i, --interactive Open the REPL even if stdin does not appear to be a terminal. -p, --print string Identical to -e, but prints the result. -r, --require module Preload the specified module at startup. Follows `require()`'s module resolution rules. module may be either a path to a file, or a Node.js module name. -v, --version Print node's version. ENVIRONMENT FORCE_COLOR Used to enable ANSI colorized output. The value may be one of: 1 , true , or an empty string to indicate 16-color support, 2 to indicate 256-color support, or 3 to indicate 16 million-color support. When used and set to a supported value, both the NO_COLOR and NODE_DISABLE_COLORS environment variables are ignored. Any other value will result in colorized output being disabled. NO_COLOR Alias for NODE_DISABLE_COLORS NODE_DEBUG modules... Comma-separated list of core modules that should print debug information. NODE_DEBUG_NATIVE modules... Comma-separated list of C++ core modules that should print debug information. NODE_DISABLE_COLORS When set to 1, colors will not be used in the REPL. NODE_EXTRA_CA_CERTS file When set, the well-known “root” CAs (like VeriSign) will be extended with the extra certificates in file. The file should consist of one or more trusted certificates in PEM format. If file is missing or misformatted, a message will be emitted once using process.emitWarning(), but any errors are otherwise ignored. This environment variable is ignored when `node` runs as setuid root or has Linux file capabilities set. The NODE_EXTRA_CA_CERTS environment variable is only read when the Node.js process is first launched. Changing the value at runtime using process.env.NODE_EXTRA_CA_CERTS has no effect on the current process. NODE_ICU_DATA file Data path for ICU (Intl object) data. Will extend linked-in data when compiled with small-icu support. NODE_NO_WARNINGS When set to 1, process warnings are silenced. NODE_OPTIONS options... A space-separated list of command-line options, which are interpreted as if they had been specified on the command line before the actual command (so they can be overridden). Node.js will exit with an error if an option that is not allowed in the environment is used, such as --print or a script file. NODE_PATH directories... A colon-separated list of directories prefixed to the module search path. NODE_PENDING_DEPRECATION When set to 1, emit pending deprecation warnings. NODE_PRESERVE_SYMLINKS When set to 1, the module loader preserves symbolic links when resolving and caching modules. NODE_REDIRECT_WARNINGS file Write process warnings to the given file instead of printing to stderr. Equivalent to passing --redirect-warnings file on the command line. NODE_REPL_HISTORY file Path to the file used to store persistent REPL history. The default path is ~/.node_repl_history, which is overridden by this variable. Setting the value to an empty string ("" or " ") will disable persistent REPL history. NODE_REPL_EXTERNAL_MODULE file Path to a Node.js module which will be loaded in place of the built-in REPL. Overriding this value to an empty string (`''`) will use the built-in REPL. NODE_SKIP_PLATFORM_CHECK When set to 1, the check for a supported platform is skipped during Node.js startup. Node.js might not execute correctly. Any issues encountered on unsupported platforms will not be fixed. NODE_TLS_REJECT_UNAUTHORIZED When set to 0, TLS certificate validation is disabled. NODE_V8_COVERAGE dir When set, Node.js writes JavaScript code coverage information to dir. OPENSSL_CONF file Load an OpenSSL configuration file on startup. Among other uses, this can be used to enable FIPS-compliant crypto if Node.js is built with ./configure --openssl-fips. If the --openssl-config command-line option is used, this environment variable is ignored. SSL_CERT_DIR dir If --use-openssl-ca is enabled, this overrides and sets OpenSSL's directory containing trusted certificates. SSL_CERT_FILE file If --use-openssl-ca is enabled, this overrides and sets OpenSSL's file containing trusted certificates. TZ Specify the timezone configuration. UV_THREADPOOL_SIZE size Sets the number of threads used in libuv's threadpool to size. BUGS Bugs are tracked in GitHub Issues: https://github.com/nodejs/node/issues COPYRIGHT Copyright Node.js contributors. Node.js is available under the MIT license. Node.js also includes external libraries that are available under a variety of licenses. See https://github.com/nodejs/node/blob/HEAD/LICENSE for the full license text. SEE ALSO Website: https://nodejs.org/ Documentation: https://nodejs.org/api/ GitHub repository and issue tracker: https://github.com/nodejs/node 2018
null
corepack
null
null
null
null
null
npx
null
null
null
null
null
npm
null
null
null
null
null
c_rehash
This command is generally equivalent to the external script c_rehash, except for minor differences noted below. openssl rehash scans directories and calculates a hash value of each .pem, .crt, .cer, or .crl file in the specified directory list and creates symbolic links for each file, where the name of the link is the hash value. (If the platform does not support symbolic links, a copy is made.) This command is useful as many programs that use OpenSSL require directories to be set up like this in order to find certificates. If any directories are named on the command line, then those are processed in turn. If not, then the SSL_CERT_DIR environment variable is consulted; this should be a colon-separated list of directories, like the Unix PATH variable. If that is not set then the default directory (installation-specific but often /usr/local/ssl/certs) is processed. In order for a directory to be processed, the user must have write permissions on that directory, otherwise an error will be generated. The links created are of the form HHHHHHHH.D, where each H is a hexadecimal character and D is a single decimal digit. When a directory is processed, all links in it that have a name in that syntax are first removed, even if they are being used for some other purpose. To skip the removal step, use the -n flag. Hashes for CRL's look similar except the letter r appears after the period, like this: HHHHHHHH.rD. Multiple objects may have the same hash; they will be indicated by incrementing the D value. Duplicates are found by comparing the full SHA-1 fingerprint. A warning will be displayed if a duplicate is found. A warning will also be displayed if there are files that cannot be parsed as either a certificate or a CRL or if more than one such object appears in the file. Script Configuration The c_rehash script uses the openssl program to compute the hashes and fingerprints. If not found in the user's PATH, then set the OPENSSL environment variable to the full pathname. Any program can be used, it will be invoked as follows for either a certificate or CRL: $OPENSSL x509 -hash -fingerprint -noout -in FILENAME $OPENSSL crl -hash -fingerprint -noout -in FILENAME where FILENAME is the filename. It must output the hash of the file on the first line, and the fingerprint on the second, optionally prefixed with some text and an equals sign.
openssl-rehash, c_rehash - Create symbolic links to files named by the hash values
openssl rehash [-h] [-help] [-old] [-compat] [-n] [-v] [-provider name] [-provider-path path] [-propquery propq] [directory] ... c_rehash [-h] [-help] [-old] [-n] [-v] [-provider name] [-provider-path path] [-propquery propq] [directory] ...
-help -h Display a brief usage message. -old Use old-style hashing (MD5, as opposed to SHA-1) for generating links to be used for releases before 1.0.0. Note that current versions will not use the old style. -n Do not remove existing links. This is needed when keeping new and old-style links in the same directory. -compat Generate links for both old-style (MD5) and new-style (SHA1) hashing. This allows releases before 1.0.0 to use these links along-side newer releases. -v Print messages about old links removed and new links created. By default, this command only lists each directory as it is processed. -provider name -provider-path path -propquery propq See "Provider Options" in openssl(1), provider(7), and property(7). ENVIRONMENT OPENSSL The path to an executable to use to generate hashes and fingerprints (see above). SSL_CERT_DIR Colon separated list of directories to operate on. Ignored if directories are listed on the command line. SEE ALSO openssl(1), openssl-crl(1), openssl-x509(1) COPYRIGHT Copyright 2015-2020 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>. 3.3.1 2024-06-04 OPENSSL-REHASH(1ssl)
null
openssl
OpenSSL is a cryptography toolkit implementing the Secure Sockets Layer (SSL) and Transport Layer Security (TLS) network protocols and related cryptography standards required by them. The openssl program is a command line program for using the various cryptography functions of OpenSSL's crypto library from the shell. It can be used for o Creation and management of private keys, public keys and parameters o Public key cryptographic operations o Creation of X.509 certificates, CSRs and CRLs o Calculation of Message Digests and Message Authentication Codes o Encryption and Decryption with Ciphers o SSL/TLS Client and Server Tests o Handling of S/MIME signed or encrypted mail o Timestamp requests, generation and verification COMMAND SUMMARY The openssl program provides a rich variety of commands (command in the "SYNOPSIS" above). Each command can have many options and argument parameters, shown above as options and parameters. Detailed documentation and use cases for most standard subcommands are available (e.g., openssl-x509(1)). The subcommand openssl-list(1) may be used to list subcommands. The command no-XXX tests whether a command of the specified name is available. If no command named XXX exists, it returns 0 (success) and prints no-XXX; otherwise it returns 1 and prints XXX. In both cases, the output goes to stdout and nothing is printed to stderr. Additional command line arguments are always ignored. Since for each cipher there is a command of the same name, this provides an easy way for shell scripts to test for the availability of ciphers in the openssl program. (no-XXX is not able to detect pseudo-commands such as quit, list, or no-XXX itself.) Configuration Option Many commands use an external configuration file for some or all of their arguments and have a -config option to specify that file. The default name of the file is openssl.cnf in the default certificate storage area, which can be determined from the openssl-version(1) command using the -d or -a option. The environment variable OPENSSL_CONF can be used to specify a different file location or to disable loading a configuration (using the empty string). Among others, the configuration file can be used to load modules and to specify parameters for generating certificates and random numbers. See config(5) for details. Standard Commands asn1parse Parse an ASN.1 sequence. ca Certificate Authority (CA) Management. ciphers Cipher Suite Description Determination. cms CMS (Cryptographic Message Syntax) command. crl Certificate Revocation List (CRL) Management. crl2pkcs7 CRL to PKCS#7 Conversion. dgst Message Digest calculation. MAC calculations are superseded by openssl-mac(1). dhparam Generation and Management of Diffie-Hellman Parameters. Superseded by openssl-genpkey(1) and openssl-pkeyparam(1). dsa DSA Data Management. dsaparam DSA Parameter Generation and Management. Superseded by openssl-genpkey(1) and openssl-pkeyparam(1). ec EC (Elliptic curve) key processing. ecparam EC parameter manipulation and generation. enc Encryption, decryption, and encoding. engine Engine (loadable module) information and manipulation. errstr Error Number to Error String Conversion. fipsinstall FIPS configuration installation. gendsa Generation of DSA Private Key from Parameters. Superseded by openssl-genpkey(1) and openssl-pkey(1). genpkey Generation of Private Key or Parameters. genrsa Generation of RSA Private Key. Superseded by openssl-genpkey(1). help Display information about a command's options. info Display diverse information built into the OpenSSL libraries. kdf Key Derivation Functions. list List algorithms and features. mac Message Authentication Code Calculation. nseq Create or examine a Netscape certificate sequence. ocsp Online Certificate Status Protocol command. passwd Generation of hashed passwords. pkcs12 PKCS#12 Data Management. pkcs7 PKCS#7 Data Management. pkcs8 PKCS#8 format private key conversion command. pkey Public and private key management. pkeyparam Public key algorithm parameter management. pkeyutl Public key algorithm cryptographic operation command. prime Compute prime numbers. rand Generate pseudo-random bytes. rehash Create symbolic links to certificate and CRL files named by the hash values. req PKCS#10 X.509 Certificate Signing Request (CSR) Management. rsa RSA key management. rsautl RSA command for signing, verification, encryption, and decryption. Superseded by openssl-pkeyutl(1). s_client This implements a generic SSL/TLS client which can establish a transparent connection to a remote server speaking SSL/TLS. It's intended for testing purposes only and provides only rudimentary interface functionality but internally uses mostly all functionality of the OpenSSL ssl library. s_server This implements a generic SSL/TLS server which accepts connections from remote clients speaking SSL/TLS. It's intended for testing purposes only and provides only rudimentary interface functionality but internally uses mostly all functionality of the OpenSSL ssl library. It provides both an own command line oriented protocol for testing SSL functions and a simple HTTP response facility to emulate an SSL/TLS-aware webserver. s_time SSL Connection Timer. sess_id SSL Session Data Management. smime S/MIME mail processing. speed Algorithm Speed Measurement. spkac SPKAC printing and generating command. srp Maintain SRP password file. This command is deprecated. storeutl Command to list and display certificates, keys, CRLs, etc. ts Time Stamping Authority command. verify X.509 Certificate Verification. See also the openssl-verification-options(1) manual page. version OpenSSL Version Information. x509 X.509 Certificate Data Management. Message Digest Commands blake2b512 BLAKE2b-512 Digest blake2s256 BLAKE2s-256 Digest md2 MD2 Digest md4 MD4 Digest md5 MD5 Digest mdc2 MDC2 Digest rmd160 RMD-160 Digest sha1 SHA-1 Digest sha224 SHA-2 224 Digest sha256 SHA-2 256 Digest sha384 SHA-2 384 Digest sha512 SHA-2 512 Digest sha3-224 SHA-3 224 Digest sha3-256 SHA-3 256 Digest sha3-384 SHA-3 384 Digest sha3-512 SHA-3 512 Digest keccak-224 KECCAK 224 Digest keccak-256 KECCAK 256 Digest keccak-384 KECCAK 384 Digest keccak-512 KECCAK 512 Digest shake128 SHA-3 SHAKE128 Digest shake256 SHA-3 SHAKE256 Digest sm3 SM3 Digest Encryption, Decryption, and Encoding Commands The following aliases provide convenient access to the most used encodings and ciphers. Depending on how OpenSSL was configured and built, not all ciphers listed here may be present. See openssl-enc(1) for more information. aes128, aes-128-cbc, aes-128-cfb, aes-128-ctr, aes-128-ecb, aes-128-ofb AES-128 Cipher aes192, aes-192-cbc, aes-192-cfb, aes-192-ctr, aes-192-ecb, aes-192-ofb AES-192 Cipher aes256, aes-256-cbc, aes-256-cfb, aes-256-ctr, aes-256-ecb, aes-256-ofb AES-256 Cipher aria128, aria-128-cbc, aria-128-cfb, aria-128-ctr, aria-128-ecb, aria-128-ofb Aria-128 Cipher aria192, aria-192-cbc, aria-192-cfb, aria-192-ctr, aria-192-ecb, aria-192-ofb Aria-192 Cipher aria256, aria-256-cbc, aria-256-cfb, aria-256-ctr, aria-256-ecb, aria-256-ofb Aria-256 Cipher base64 Base64 Encoding bf, bf-cbc, bf-cfb, bf-ecb, bf-ofb Blowfish Cipher camellia128, camellia-128-cbc, camellia-128-cfb, camellia-128-ctr, camellia-128-ecb, camellia-128-ofb Camellia-128 Cipher camellia192, camellia-192-cbc, camellia-192-cfb, camellia-192-ctr, camellia-192-ecb, camellia-192-ofb Camellia-192 Cipher camellia256, camellia-256-cbc, camellia-256-cfb, camellia-256-ctr, camellia-256-ecb, camellia-256-ofb Camellia-256 Cipher cast, cast-cbc CAST Cipher cast5-cbc, cast5-cfb, cast5-ecb, cast5-ofb CAST5 Cipher chacha20 Chacha20 Cipher des, des-cbc, des-cfb, des-ecb, des-ede, des-ede-cbc, des-ede-cfb, des-ede-ofb, des-ofb DES Cipher des3, desx, des-ede3, des-ede3-cbc, des-ede3-cfb, des-ede3-ofb Triple-DES Cipher idea, idea-cbc, idea-cfb, idea-ecb, idea-ofb IDEA Cipher rc2, rc2-cbc, rc2-cfb, rc2-ecb, rc2-ofb RC2 Cipher rc4 RC4 Cipher rc5, rc5-cbc, rc5-cfb, rc5-ecb, rc5-ofb RC5 Cipher seed, seed-cbc, seed-cfb, seed-ecb, seed-ofb SEED Cipher sm4, sm4-cbc, sm4-cfb, sm4-ctr, sm4-ecb, sm4-ofb SM4 Cipher
openssl - OpenSSL command line program
openssl command [ options ... ] [ parameters ... ] openssl no-XXX [ options ] openssl -help | -version
Details of which options are available depend on the specific command. This section describes some common options with common behavior. Program Options These options can be specified without a command specified to get help or version information. -help Provides a terse summary of all options. For more detailed information, each command supports a -help option. Accepts --help as well. -version Provides a terse summary of the openssl program version. For more detailed information see openssl-version(1). Accepts --version as well. Common Options -help If an option takes an argument, the "type" of argument is also given. -- This terminates the list of options. It is mostly useful if any filename parameters start with a minus sign: openssl verify [flags...] -- -cert1.pem... Format Options See openssl-format-options(1) for manual page. Pass Phrase Options See the openssl-passphrase-options(1) manual page. Random State Options Prior to OpenSSL 1.1.1, it was common for applications to store information about the state of the random-number generator in a file that was loaded at startup and rewritten upon exit. On modern operating systems, this is generally no longer necessary as OpenSSL will seed itself from a trusted entropy source provided by the operating system. These flags are still supported for special platforms or circumstances that might require them. It is generally an error to use the same seed file more than once and every use of -rand should be paired with -writerand. -rand files A file or files containing random data used to seed the random number generator. Multiple files can be specified separated by an OS-dependent character. The separator is ";" for MS-Windows, "," for OpenVMS, and ":" for all others. Another way to specify multiple files is to repeat this flag with different filenames. -writerand file Writes the seed data to the specified file upon exit. This file can be used in a subsequent command invocation. Certificate Verification Options See the openssl-verification-options(1) manual page. Name Format Options See the openssl-namedisplay-options(1) manual page. TLS Version Options Several commands use SSL, TLS, or DTLS. By default, the commands use TLS and clients will offer the lowest and highest protocol version they support, and servers will pick the highest version that the client offers that is also supported by the server. The options below can be used to limit which protocol versions are used, and whether TCP (SSL and TLS) or UDP (DTLS) is used. Note that not all protocols and flags may be available, depending on how OpenSSL was built. -ssl3, -tls1, -tls1_1, -tls1_2, -tls1_3, -no_ssl3, -no_tls1, -no_tls1_1, -no_tls1_2, -no_tls1_3 These options require or disable the use of the specified SSL or TLS protocols. When a specific TLS version is required, only that version will be offered or accepted. Only one specific protocol can be given and it cannot be combined with any of the no_ options. The no_* options do not work with s_time and ciphers commands but work with s_client and s_server commands. -dtls, -dtls1, -dtls1_2 These options specify to use DTLS instead of TLS. With -dtls, clients will negotiate any supported DTLS protocol version. Use the -dtls1 or -dtls1_2 options to support only DTLS1.0 or DTLS1.2, respectively. Engine Options -engine id Load the engine identified by id and use all the methods it implements (algorithms, key storage, etc.), unless specified otherwise in the command-specific documentation or it is configured to do so, as described in "Engine Configuration" in config(5). The engine will be used for key ids specified with -key and similar options when an option like -keyform engine is given. A special case is the "loader_attic" engine, which is meant just for internal OpenSSL testing purposes and supports loading keys, parameters, certificates, and CRLs from files. When this engine is used, files with such credentials are read via this engine. Using the "file:" schema is optional; a plain file (path) name will do. Options specifying keys, like -key and similar, can use the generic OpenSSL engine key loading URI scheme "org.openssl.engine:" to retrieve private keys and public keys. The URI syntax is as follows, in simplified form: org.openssl.engine:{engineid}:{keyid} Where "{engineid}" is the identity/name of the engine, and "{keyid}" is a key identifier that's acceptable by that engine. For example, when using an engine that interfaces against a PKCS#11 implementation, the generic key URI would be something like this (this happens to be an example for the PKCS#11 engine that's part of OpenSC): -key org.openssl.engine:pkcs11:label_some-private-key As a third possibility, for engines and providers that have implemented their own OSSL_STORE_LOADER(3), "org.openssl.engine:" should not be necessary. For a PKCS#11 implementation that has implemented such a loader, the PKCS#11 URI as defined in RFC 7512 should be possible to use directly: -key pkcs11:object=some-private-key;pin-value=1234 Provider Options -provider name Load and initialize the provider identified by name. The name can be also a path to the provider module. In that case the provider name will be the specified path and not just the provider module name. Interpretation of relative paths is platform specific. The configured "MODULESDIR" path, OPENSSL_MODULES environment variable, or the path specified by -provider-path is prepended to relative paths. See provider(7) for a more detailed description. -provider-path path Specifies the search path that is to be used for looking for providers. Equivalently, the OPENSSL_MODULES environment variable may be set. -propquery propq Specifies the property query clause to be used when fetching algorithms from the loaded providers. See property(7) for a more detailed description. ENVIRONMENT The OpenSSL library can be take some configuration parameters from the environment. Some of these variables are listed below. For information about specific commands, see openssl-engine(1), openssl-rehash(1), and tsget(1). For information about the use of environment variables in configuration, see "ENVIRONMENT" in config(5). For information about querying or specifying CPU architecture flags, see OPENSSL_ia32cap(3), and OPENSSL_s390xcap(3). For information about all environment variables used by the OpenSSL libraries, see openssl-env(7). OPENSSL_TRACE=name[,...] Enable tracing output of OpenSSL library, by name. This output will only make sense if you know OpenSSL internals well. Also, it might not give you any output at all if OpenSSL was built without tracing support. The value is a comma separated list of names, with the following available: TRACE Traces the OpenSSL trace API itself. INIT Traces OpenSSL library initialization and cleanup. TLS Traces the TLS/SSL protocol. TLS_CIPHER Traces the ciphers used by the TLS/SSL protocol. CONF Show details about provider and engine configuration. ENGINE_TABLE The function that is used by RSA, DSA (etc) code to select registered ENGINEs, cache defaults and functional references (etc), will generate debugging summaries. ENGINE_REF_COUNT Reference counts in the ENGINE structure will be monitored with a line of generated for each change. PKCS5V2 Traces PKCS#5 v2 key generation. PKCS12_KEYGEN Traces PKCS#12 key generation. PKCS12_DECRYPT Traces PKCS#12 decryption. X509V3_POLICY Generates the complete policy tree at various points during X.509 v3 policy evaluation. BN_CTX Traces BIGNUM context operations. CMP Traces CMP client and server activity. STORE Traces STORE operations. DECODER Traces decoder operations. ENCODER Traces encoder operations. REF_COUNT Traces decrementing certain ASN.1 structure references. HTTP Traces the HTTP client and server, such as messages being sent and received. SEE ALSO openssl-asn1parse(1), openssl-ca(1), openssl-ciphers(1), openssl-cms(1), openssl-crl(1), openssl-crl2pkcs7(1), openssl-dgst(1), openssl-dhparam(1), openssl-dsa(1), openssl-dsaparam(1), openssl-ec(1), openssl-ecparam(1), openssl-enc(1), openssl-engine(1), openssl-errstr(1), openssl-gendsa(1), openssl-genpkey(1), openssl-genrsa(1), openssl-kdf(1), openssl-list(1), openssl-mac(1), openssl-nseq(1), openssl-ocsp(1), openssl-passwd(1), openssl-pkcs12(1), openssl-pkcs7(1), openssl-pkcs8(1), openssl-pkey(1), openssl-pkeyparam(1), openssl-pkeyutl(1), openssl-prime(1), openssl-rand(1), openssl-rehash(1), openssl-req(1), openssl-rsa(1), openssl-rsautl(1), openssl-s_client(1), openssl-s_server(1), openssl-s_time(1), openssl-sess_id(1), openssl-smime(1), openssl-speed(1), openssl-spkac(1), openssl-srp(1), openssl-storeutl(1), openssl-ts(1), openssl-verify(1), openssl-version(1), openssl-x509(1), config(5), crypto(7), openssl-env(7). ssl(7), x509v3_config(5) HISTORY The list -XXX-algorithms options were added in OpenSSL 1.0.0; For notes on the availability of other commands, see their individual manual pages. The -issuer_checks option is deprecated as of OpenSSL 1.1.0 and is silently ignored. The -xcertform and -xkeyform options are obsolete since OpenSSL 3.0 and have no effect. The interactive mode, which could be invoked by running "openssl" with no further arguments, was removed in OpenSSL 3.0, and running that program with no arguments is now equivalent to "openssl help". COPYRIGHT Copyright 2000-2023 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>. 3.3.1 2024-06-04 OPENSSL(1ssl)
null
jwebserver
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]
jwebserver - launch the Java Simple Web Server
jwebserver [options]
Command-line options. For a detailed description of the options, see 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. JDK 22 2024 JWEBSERVER(1)
null
jarsigner
The jarsigner tool has two purposes: • To sign Java Archive (JAR) files. • To verify the signatures and integrity of signed JAR files. The JAR feature enables the packaging of class files, images, sounds, and other digital data in a single file for faster and easier distribution. A tool named jar enables developers to produce JAR files. (Technically, any ZIP file can also be considered a JAR file, although when created by the jar command or processed by the jarsigner command, JAR files also contain a META-INF/MANIFEST.MF file.) A digital signature is a string of bits that is computed from some data (the data being signed) and the private key of an entity (a person, company, and so on). Similar to a handwritten signature, a digital signature has many useful characteristics: • Its authenticity can be verified by a computation that uses the public key corresponding to the private key used to generate the signature. • It can't be forged, assuming the private key is kept secret. • It is a function of the data signed and thus can't be claimed to be the signature for other data as well. • The signed data can't be changed. If the data is changed, then the signature can't be verified as authentic. To generate an entity's signature for a file, the entity must first have a public/private key pair associated with it and one or more certificates that authenticate its public key. A certificate is a digitally signed statement from one entity that says that the public key of another entity has a particular value. The jarsigner command uses key and certificate information from a keystore to generate digital signatures for JAR files. A keystore is a database of private keys and their associated X.509 certificate chains that authenticate the corresponding public keys. The keytool command is used to create and administer keystores. The jarsigner command uses an entity's private key to generate a signature. The signed JAR file contains, among other things, a copy of the certificate from the keystore for the public key corresponding to the private key used to sign the file. The jarsigner command can verify the digital signature of the signed JAR file using the certificate inside it (in its signature block file). The jarsigner command can generate signatures that include a time stamp that enables a systems or deployer to check whether the JAR file was signed while the signing certificate was still valid. In addition, APIs allow applications to obtain the timestamp information. At this time, the jarsigner command can only sign JAR files created by the jar command or zip files. JAR files are the same as zip files, except they also have a META-INF/MANIFEST.MF file. A META-INF/MANIFEST.MF file is created when the jarsigner command signs a zip file. The default jarsigner command behavior is to sign a JAR or zip file. Use the -verify option to verify a signed JAR file. The jarsigner command also attempts to validate the signer's certificate after signing or verifying. During validation, it checks the revocation status of each certificate in the signer's certificate chain when the -revCheck option is specified. If there is a validation error or any other problem, the command generates warning messages. If you specify the -strict option, then the command treats severe warnings as errors. See Errors and Warnings. KEYSTORE ALIASES All keystore entities are accessed with unique aliases. When you use the jarsigner command to sign a JAR file, you must specify the alias for the keystore entry that contains the private key needed to generate the signature. If no output file is specified, it overwrites the original JAR file with the signed JAR file. Keystores are protected with a password, so the store password must be specified. You are prompted for it when you don't specify it on the command line. Similarly, private keys are protected in a keystore with a password, so the private key's password must be specified, and you are prompted for the password when you don't specify it on the command line and it isn't the same as the store password. KEYSTORE LOCATION The jarsigner command has a -keystore option for specifying the URL of the keystore to be used. The keystore is by default stored in a file named .keystore in the user's home directory, as determined by the user.home system property. Linux and macOS: user.home defaults to the user's home directory. The input stream from the -keystore option is passed to the KeyStore.load method. If NONE is specified as the URL, then a null stream is passed to the KeyStore.load method. NONE should be specified when the KeyStore class isn't file based, for example, when it resides on a hardware token device. KEYSTORE IMPLEMENTATION The KeyStore class provided in the java.security package supplies a number of well-defined interfaces to access and modify the information in a keystore. You can have multiple different concrete implementations, where each implementation is for a particular type of keystore. Currently, there are two command-line tools that use keystore implementations (keytool and jarsigner). The default keystore implementation is PKCS12. This is a cross platform keystore based on the RSA PKCS12 Personal Information Exchange Syntax Standard. This standard is primarily meant for storing or transporting a user's private keys, certificates, and miscellaneous secrets. There is another built-in implementation, provided by Oracle. It implements the keystore as a file with a proprietary keystore type (format) named JKS. It protects each private key with its individual password, and also protects the integrity of the entire keystore with a (possibly different) password. Keystore implementations are provider-based, which means the application interfaces supplied by the KeyStore class are implemented in terms of a Service Provider Interface (SPI). There is a corresponding abstract KeystoreSpi class, also in the java.security package, that defines the Service Provider Interface methods that providers must implement. The term provider refers to a package or a set of packages that supply a concrete implementation of a subset of services that can be accessed by the Java Security API. To provide a keystore implementation, clients must implement a provider and supply a KeystoreSpi subclass implementation, as described in How to Implement a Provider in the Java Cryptography Architecture [https://www.oracle.com/pls/topic/lookup?ctx=en/java/javase&id=security_guide_implement_provider_jca]. Applications can choose different types of keystore implementations from different providers, with the getInstance factory method in the KeyStore class. A keystore type defines the storage and data format of the keystore information and the algorithms used to protect private keys in the keystore and the integrity of the keystore itself. Keystore implementations of different types aren't compatible. The jarsigner commands can read file-based keystores from any location that can be specified using a URL. In addition, these commands can read non-file-based keystores such as those provided by MSCAPI on Windows and PKCS11 on all platforms. For the jarsigner and keytool commands, you can specify a keystore type at the command line with the -storetype option. If you don't explicitly specify a keystore type, then the tools choose a keystore implementation based on the value of the keystore.type property specified in the security properties file. The security properties file is called java.security, and it resides in the JDK security properties directory, java.home/conf/security. Each tool gets the keystore.type value and then examines all the installed providers until it finds one that implements keystores of that type. It then uses the keystore implementation from that provider. The KeyStore class defines a static method named getDefaultType that lets applications retrieve the value of the keystore.type property. The following line of code creates an instance of the default keystore type as specified in the keystore.type property: KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); The default keystore type is pkcs12, which is a cross platform keystore based on the RSA PKCS12 Personal Information Exchange Syntax Standard. This is specified by the following line in the security properties file: keystore.type=pkcs12 Case doesn't matter in keystore type designations. For example, JKS is the same as jks. To have the tools utilize a keystore implementation other than the default, you can change that line to specify a different keystore type. For example, if you want to use the Oracle's jks keystore implementation, then change the line to the following: keystore.type=jks SUPPORTED ALGORITHMS By default, the jarsigner command signs a JAR file using one of the following algorithms and block file extensions depending on the type and size of the private key: Default Signature Algorithms and Block File Extensions keyalg key size default sigalg block file extension ────────────────────────────────────────────────────── DSA any size SHA256withDSA .DSA RSA < 624 SHA256withRSA .RSA <= 7680 SHA384withRSA > 7680 SHA512withRSA EC < 512 SHA384withECDSA .EC >= 512 SHA512withECDSA RSASSA-PSS < 624 RSASSA-PSS (with .RSA SHA-256) <= 7680 RSASSA-PSS (with SHA-384) > 7680 RSASSA-PSS (with SHA-512) EdDSA 255 Ed25519 .EC 448 Ed448 • If an RSASSA-PSS key is encoded with parameters, then jarsigner will use the same parameters in the signature. Otherwise, jarsigner will use parameters that are determined by the size of the key as specified in the table above. For example, an 3072-bit RSASSA-PSS key will use RSASSA-PSS as the signature algorithm and SHA-384 as the hash and MGF1 algorithms. • If a key algorithm is not listed in this table, the .DSA extension is used when signing a JAR file. These default signature algorithms can be overridden by using the -sigalg option. The jarsigner command uses the jdk.jar.disabledAlgorithms and jdk.security.legacyAlgorithms security properties to determine which algorithms are considered a security risk. If the JAR file was signed with any algorithms that are disabled, it will be treated as an unsigned JAR file. If the JAR file was signed with any legacy algorithms, it will be treated as signed with an informational warning to inform users that the legacy algorithm will be disabled in a future update. For detailed verification output, include -J-Djava.security.debug=jar. The jdk.jar.disabledAlgorithms and jdk.security.legacyAlgorithms security properties are defined in the java.security file (located in the JDK's $JAVA_HOME/conf/security directory). Note: In order to improve out of the box security, default key size and signature algorithm names are periodically updated to stronger values with each release of the JDK. If interoperability with older releases of the JDK is important, please make sure the defaults are supported by those releases, or alternatively use the -sigalg option to override the default values at your own risk. THE SIGNED JAR FILE When the jarsigner command is used to sign a JAR file, the output signed JAR file is exactly the same as the input JAR file, except that it has two additional files placed in the META-INF directory: • A signature file with an .SF extension • A signature block file with a .DSA, .RSA, or .EC extension The base file names for these two files come from the value of the -sigfile option. For example, when the option is -sigfile MKSIGN, the files are named MKSIGN.SF and MKSIGN.RSA. In this document, we assume the signer always uses an RSA key. If no -sigfile option appears on the command line, then the base file name for the .SF and the signature block files is the first 8 characters of the alias name specified on the command line, all converted to uppercase. If the alias name has fewer than 8 characters, then the full alias name is used. If the alias name contains any characters that aren't allowed in a signature file name, then each such character is converted to an underscore (_) character in forming the file name. Valid characters include letters, digits, underscores, and hyphens. SIGNATURE FILE A signature file (.SF file) looks similar to the manifest file that is always included in a JAR file when the jarsigner command is used to sign the file. For each source file included in the JAR file, the .SF file has two lines, such as in the manifest file, that list the following: • File name • Name of the digest algorithm (SHA) • SHA digest value Note: The name of the digest algorithm (SHA) and the SHA digest value are on the same line. In the manifest file, the SHA digest value for each source file is the digest (hash) of the binary data in the source file. In the .SF file, the digest value for a specified source file is the hash of the two lines in the manifest file for the source file. The signature file, by default, includes a header with a hash of the whole manifest file. The header also contains a hash of the manifest header. The presence of the header enables verification optimization. See JAR File Verification. SIGNATURE BLOCK FILE The .SF file is signed and the signature is placed in the signature block file. This file also contains, encoded inside it, the certificate or certificate chain from the keystore that authenticates the public key corresponding to the private key used for signing. The file has the extension .DSA, .RSA, or .EC, depending on the key algorithm used. See the table in Supported Algorithms. SIGNATURE TIME STAMP The jarsigner command used with the following options generates and stores a signature time stamp when signing a JAR file: • -tsa url • -tsacert alias • -tsapolicyid policyid • -tsadigestalg algorithm See Options for jarsigner. JAR FILE VERIFICATION A successful JAR file verification occurs when the signatures are valid, and none of the files that were in the JAR file when the signatures were generated have changed since then. JAR file verification involves the following steps: 1. Verify the signature of the .SF file. The verification ensures that the signature stored in each signature block file was generated using the private key corresponding to the public key whose certificate (or certificate chain) also appears in the signature block file. It also ensures that the signature is a valid signature of the corresponding signature (.SF) file, and thus the .SF file wasn't tampered with. 2. Verify the digest listed in each entry in the .SF file with each corresponding section in the manifest. The .SF file by default includes a header that contains a hash of the entire manifest file. When the header is present, the verification can check to see whether or not the hash in the header matches the hash of the manifest file. If there is a match, then verification proceeds to the next step. If there is no match, then a less optimized verification is required to ensure that the hash in each source file information section in the .SF file equals the hash of its corresponding section in the manifest file. See Signature File. One reason the hash of the manifest file that is stored in the .SF file header might not equal the hash of the current manifest file is that it might contain sections for newly added files after the file was signed. For example, suppose one or more files were added to the signed JAR file (using the jar tool) that already contains a signature and a .SF file. If the JAR file is signed again by a different signer, then the manifest file is changed (sections are added to it for the new files by the jarsigner tool) and a new .SF file is created, but the original .SF file is unchanged. A verification is still considered successful if none of the files that were in the JAR file when the original signature was generated have been changed since then. This is because the hashes in the non-header sections of the .SF file equal the hashes of the corresponding sections in the manifest file. 3. Read each file in the JAR file that has an entry in the .SF file. While reading, compute the file's digest and compare the result with the digest for this file in the manifest section. The digests should be the same or verification fails. If any serious verification failures occur during the verification process, then the process is stopped and a security exception is thrown. The jarsigner command catches and displays the exception. 4. Check for disabled algorithm usage. See Supported Algorithms. Note: You should read any addition warnings (or errors if you specified the -strict option), as well as the content of the certificate (by specifying the -verbose and -certs options) to determine if the signature can be trusted. MULTIPLE SIGNATURES FOR A JAR FILE A JAR file can be signed by multiple people by running the jarsigner command on the file multiple times and specifying the alias for a different person each time, as follows: jarsigner myBundle.jar susan jarsigner myBundle.jar kevin When a JAR file is signed multiple times, there are multiple .SF and signature block files in the resulting JAR file, one pair for each signature. In the previous example, the output JAR file includes files with the following names: SUSAN.SF SUSAN.RSA KEVIN.SF KEVIN.RSA OPTIONS FOR JARSIGNER The following sections describe the options for the jarsigner. Be aware of the following standards: • All option names are preceded by a hyphen sign (-). • The options can be provided in any order. • Items that are in italics or underlined (option values) represent the actual values that must be supplied. • The -storepass, -keypass, -sigfile, -sigalg, -digestalg, -signedjar, and TSA-related options are only relevant when signing a JAR file; they aren't relevant when verifying a signed JAR file. The -keystore option is relevant for signing and verifying a JAR file. In addition, aliases are specified when signing and verifying a JAR file. -keystore url Specifies the URL that tells the keystore location. This defaults to the file .keystore in the user's home directory, as determined by the user.home system property. A keystore is required when signing. You must explicitly specify a keystore when the default keystore doesn't exist or if you want to use one other than the default. A keystore isn't required when verifying, but if one is specified or the default exists and the -verbose option was also specified, then additional information is output regarding whether or not any of the certificates used to verify the JAR file are contained in that keystore. The -keystore argument can be a file name and path specification rather than a URL, in which case it is treated the same as a file: URL, for example, the following are equivalent: • -keystore filePathAndName • -keystore file:filePathAndName If the Sun PKCS #11 provider was configured in the java.security security properties file (located in the JDK's $JAVA_HOME/conf/security directory), then the keytool and jarsigner tools can operate on the PKCS #11 token by specifying these options: -keystore NONE -storetype PKCS11 For example, the following command lists the contents of the configured PKCS#11 token: keytool -keystore NONE -storetype PKCS11 -list -storepass [:env | :file] argument Specifies the password that is required to access the keystore. This is only needed when signing (not verifying) a JAR file. In that case, if a -storepass option isn't provided at the command line, then the user is prompted for the password. If the modifier env or file isn't specified, then the password has the value argument. Otherwise, the password is retrieved as follows: • env: Retrieve the password from the environment variable named argument. • file: Retrieve the password from the file named argument. Note: The password shouldn't be specified on the command line or in a script unless it is for testing purposes, or you are on a secure system. -storetype storetype Specifies the type of keystore to be instantiated. The default keystore type is the one that is specified as the value of the keystore.type property in the security properties file, which is returned by the static getDefaultType method in java.security.KeyStore. The PIN for a PKCS #11 token can also be specified with the -storepass option. If none is specified, then the keytool and jarsigner commands prompt for the token PIN. If the token has a protected authentication path (such as a dedicated PIN-pad or a biometric reader), then the -protected option must be specified and no password options can be specified. -keypass [:env | :file] argument -certchain file Specifies the password used to protect the private key of the keystore entry addressed by the alias specified on the command line. The password is required when using jarsigner to sign a JAR file. If no password is provided on the command line, and the required password is different from the store password, then the user is prompted for it. If the modifier env or file isn't specified, then the password has the value argument. Otherwise, the password is retrieved as follows: • env: Retrieve the password from the environment variable named argument. • file: Retrieve the password from the file named argument. Note: The password shouldn't be specified on the command line or in a script unless it is for testing purposes, or you are on a secure system. -certchain file Specifies the certificate chain to be used when the certificate chain associated with the private key of the keystore entry that is addressed by the alias specified on the command line isn't complete. This can happen when the keystore is located on a hardware token where there isn't enough capacity to hold a complete certificate chain. The file can be a sequence of concatenated X.509 certificates, or a single PKCS#7 formatted data block, either in binary encoding format or in printable encoding format (also known as Base64 encoding) as defined by Internet RFC 1421 Certificate Encoding Standard [http://tools.ietf.org/html/rfc1421]. -sigfile file Specifies the base file name to be used for the generated .SF and signature block files. For example, if file is DUKESIGN, then the generated .SF and signature block files are named DUKESIGN.SF and DUKESIGN.RSA, and placed in the META-INF directory of the signed JAR file. The characters in the file must come from the set a-zA-Z0-9_-. Only letters, numbers, underscore, and hyphen characters are allowed. All lowercase characters are converted to uppercase for the .SF and signature block file names. If no -sigfile option appears on the command line, then the base file name for the .SF and signature block files is the first 8 characters of the alias name specified on the command line, all converted to upper case. If the alias name has fewer than 8 characters, then the full alias name is used. If the alias name contains any characters that aren't valid in a signature file name, then each such character is converted to an underscore (_) character to form the file name. -signedjar file Specifies the name of signed JAR file. -digestalg algorithm Specifies the name of the message digest algorithm to use when digesting the entries of a JAR file. For a list of standard message digest algorithm names, see the Java Security Standard Algorithm Names Specification. If this option isn't specified, then SHA-384 is used. There must either be a statically installed provider supplying an implementation of the specified algorithm or the user must specify one with the -addprovider or -providerClass options; otherwise, the command will not succeed. -sigalg algorithm Specifies the name of the signature algorithm to use to sign the JAR file. This algorithm must be compatible with the private key used to sign the JAR file. If this option isn't specified, then use a default algorithm matching the private key as described in the Supported Algorithms section. There must either be a statically installed provider supplying an implementation of the specified algorithm or you must specify one with the -addprovider or -providerClass option; otherwise, the command doesn't succeed. For a list of standard signature algorithm names, see the Java Security Standard Algorithm Names Specification. -verify Verifies a signed JAR file. -verbose[:suboptions] When the -verbose option appears on the command line, it indicates that the jarsigner use the verbose mode when signing or verifying with the suboptions determining how much information is shown. This causes the , which causes jarsigner to output extra information about the progress of the JAR signing or verification. The suboptions can be all, grouped, or summary. If the -certs option is also specified, then the default mode (or suboption all) displays each entry as it is being processed, and after that, the certificate information for each signer of the JAR file. If the -certs and the -verbose:grouped suboptions are specified, then entries with the same signer info are grouped and displayed together with their certificate information. If -certs and the -verbose:summary suboptions are specified, then entries with the same signer information are grouped and displayed together with their certificate information. Details about each entry are summarized and displayed as one entry (and more). See Example of Verifying a Signed JAR File and Example of Verification with Certificate Information. -certs If the -certs option appears on the command line with the -verify and -verbose options, then the output includes certificate information for each signer of the JAR file. This information includes the name of the type of certificate (stored in the signature block file) that certifies the signer's public key, and if the certificate is an X.509 certificate (an instance of the java.security.cert.X509Certificate), then the distinguished name of the signer. The keystore is also examined. If no keystore value is specified on the command line, then the default keystore file (if any) is checked. If the public key certificate for a signer matches an entry in the keystore, then the alias name for the keystore entry for that signer is displayed in parentheses. -revCheck This option enables revocation checking of certificates when signing or verifying a JAR file. The jarsigner command attempts to make network connections to fetch OCSP responses and CRLs if the -revCheck option is specified on the command line. Note that revocation checks are not enabled unless this option is specified. -tsa url If -tsa http://example.tsa.url appears on the command line when signing a JAR file then a time stamp is generated for the signature. The URL, http://example.tsa.url, identifies the location of the Time Stamping Authority (TSA) and overrides any URL found with the -tsacert option. The -tsa option doesn't require the TSA public key certificate to be present in the keystore. To generate the time stamp, jarsigner communicates with the TSA with the Time-Stamp Protocol (TSP) defined in RFC 3161. When successful, the time stamp token returned by the TSA is stored with the signature in the signature block file. -tsacert alias When -tsacert alias appears on the command line when signing a JAR file, a time stamp is generated for the signature. The alias identifies the TSA public key certificate in the keystore that is in effect. The entry's certificate is examined for a Subject Information Access extension that contains a URL identifying the location of the TSA. The TSA public key certificate must be present in the keystore when using the -tsacert option. -tsapolicyid policyid Specifies the object identifier (OID) that identifies the policy ID to be sent to the TSA server. If this option isn't specified, no policy ID is sent and the TSA server will choose a default policy ID. Object identifiers are defined by X.696, which is an ITU Telecommunication Standardization Sector (ITU-T) standard. These identifiers are typically period-separated sets of non-negative digits like 1.2.3.4, for example. -tsadigestalg algorithm Specifies the message digest algorithm that is used to generate the message imprint to be sent to the TSA server. If this option isn't specified, SHA-384 will be used. See Supported Algorithms. For a list of standard message digest algorithm names, see the Java Security Standard Algorithm Names Specification. -internalsf In the past, the signature block file generated when a JAR file was signed included a complete encoded copy of the .SF file (signature file) also generated. This behavior has been changed. To reduce the overall size of the output JAR file, the signature block file by default doesn't contain a copy of the .SF file anymore. If -internalsf appears on the command line, then the old behavior is utilized. This option is useful for testing. In practice, don't use the -internalsf option because it incurs higher overhead. -sectionsonly If the -sectionsonly option appears on the command line, then the .SF file (signature file) generated when a JAR file is signed doesn't include a header that contains a hash of the whole manifest file. It contains only the information and hashes related to each individual source file included in the JAR file. See Signature File. By default, this header is added, as an optimization. When the header is present, whenever the JAR file is verified, the verification can first check to see whether the hash in the header matches the hash of the whole manifest file. When there is a match, verification proceeds to the next step. When there is no match, it is necessary to do a less optimized verification that the hash in each source file information section in the .SF file equals the hash of its corresponding section in the manifest file. See JAR File Verification. The -sectionsonly option is primarily used for testing. It shouldn't be used other than for testing because using it incurs higher overhead. -protected Values can be either true or false. Specify true when a password must be specified through a protected authentication path such as a dedicated PIN reader. -providerName providerName If more than one provider was configured in the java.security security properties file, then you can use the -providerName option to target a specific provider instance. The argument to this option is the name of the provider. For the Oracle PKCS #11 provider, providerName is of the form SunPKCS11-TokenName, where TokenName is the name suffix that the provider instance has been configured with, as detailed in the configuration attributes table. For example, the following command lists the contents of the PKCS #11 keystore provider instance with name suffix SmartCard: jarsigner -keystore NONE -storetype PKCS11 -providerName SunPKCS11-SmartCard -list -addprovider name [-providerArg arg] Adds a security provider by name (such as SunPKCS11) and an optional configure argument. The value of the security provider is the name of a security provider that is defined in a module. Used with the -providerArg ConfigFilePath option, the keytool and jarsigner tools install the provider dynamically and use ConfigFilePath for the path to the token configuration file. The following example shows a command to list a PKCS #11 keystore when the Oracle PKCS #11 provider wasn't configured in the security properties file. jarsigner -keystore NONE -storetype PKCS11 -addprovider SunPKCS11 -providerArg /mydir1/mydir2/token.config -providerClass provider-class-name [-providerArg arg] Used to specify the name of cryptographic service provider's master class file when the service provider isn't listed in the java.security security properties file. Adds a security provider by fully-qualified class name and an optional configure argument. Note: The preferred way to load PKCS11 is by using modules. See -addprovider. -providerPath classpath Used to specify the classpath for providers specified by the -providerClass option. Multiple paths should be separated by the system-dependent path-separator character. -Jjavaoption Passes through the specified javaoption string directly to the Java interpreter. The jarsigner command is a wrapper around the interpreter. This option shouldn't contain any spaces. It is useful for adjusting the execution environment or memory usage. For a list of possible interpreter options, type java -h or java -X at the command line. -strict During the signing or verifying process, the command may issue warning messages. If you specify this option, the exit code of the tool reflects the severe warning messages that this command found. See Errors and Warnings. -conf url Specifies a pre-configured options file. Read the keytool documentation for details. The property keys supported are "jarsigner.all" for all actions, "jarsigner.sign" for signing, and "jarsigner.verify" for verification. jarsigner arguments including the JAR file name and alias name(s) cannot be set in this file. -version Prints the program version. ERRORS AND WARNINGS During the signing or verifying process, the jarsigner command may issue various errors or warnings. If there is a failure, the jarsigner command exits with code 1. If there is no failure, but there are one or more severe warnings, the jarsigner command exits with code 0 when the -strict option is not specified, or exits with the OR-value of the warning codes when the -strict is specified. If there is only informational warnings or no warning at all, the command always exits with code 0. For example, if a certificate used to sign an entry is expired and has a KeyUsage extension that doesn't allow it to sign a file, the jarsigner command exits with code 12 (=4+8) when the -strict option is specified. Note: Exit codes are reused because only the values from 0 to 255 are legal on Linux and macOS. The following sections describes the names, codes, and descriptions of the errors and warnings that the jarsigner command can issue. FAILURE Reasons why the jarsigner command fails include (but aren't limited to) a command line parsing error, the inability to find a keypair to sign the JAR file, or the verification of a signed JAR fails. failure Code 1. The signing or verifying fails. SEVERE WARNINGS Note: Severe warnings are reported as errors if you specify the -strict option. Reasons why the jarsigner command issues a severe warning include the certificate used to sign the JAR file has an error or the signed JAR file has other problems. hasExpiredCert Code 4. This JAR contains entries whose signer certificate has expired. hasExpiredTsaCert Code 4. The timestamp has expired. notYetValidCert Code 4. This JAR contains entries whose signer certificate isn't yet valid. chainNotValidated Code 4. This JAR contains entries whose certificate chain isn't validated. tsaChainNotValidated Code 64. The timestamp is invalid. signerSelfSigned Code 4. This JAR contains entries whose signer certificate is self signed. disabledAlg Code 4. An algorithm used is considered a security risk and is disabled. badKeyUsage Code 8. This JAR contains entries whose signer certificate's KeyUsage extension doesn't allow code signing. badExtendedKeyUsage Code 8. This JAR contains entries whose signer certificate's ExtendedKeyUsage extension doesn't allow code signing. badNetscapeCertType Code 8. This JAR contains entries whose signer certificate's NetscapeCertType extension doesn't allow code signing. hasUnsignedEntry Code 16. This JAR contains unsigned entries which haven't been integrity-checked. notSignedByAlias Code 32. This JAR contains signed entries which aren't signed by the specified alias(es). aliasNotInStore Code 32. This JAR contains signed entries that aren't signed by alias in this keystore. tsaChainNotValidated Code 64. This JAR contains entries whose TSA certificate chain is invalid. INFORMATIONAL WARNINGS Informational warnings include those that aren't errors but regarded as bad practice. They don't have a code. extraAttributesDetected The POSIX file permissions and/or symlink attributes are detected during signing or verifying a JAR file. The jarsigner tool preserves these attributes in the newly signed file but warns that these attributes are unsigned and not protected by the signature. hasExpiringCert This JAR contains entries whose signer certificate expires within six months. hasExpiringTsaCert The timestamp will expire within one year on YYYY-MM-DD. legacyAlg An algorithm used is considered a security risk but not disabled. noTimestamp This JAR contains signatures that doesn't include a timestamp. Without a timestamp, users may not be able to validate this JAR file after the signer certificate's expiration date (YYYY-MM-DD) or after any future revocation date. EXAMPLE OF SIGNING A JAR FILE Use the following command to sign bundle.jar with the private key of a user whose keystore alias is jane in a keystore named mystore in the working directory and name the signed JAR file sbundle.jar: jarsigner -keystore /working/mystore -storepass keystore_password -keypass private_key_password -signedjar sbundle.jar bundle.jar jane There is no -sigfile specified in the previous command so the generated .SF and signature block files to be placed in the signed JAR file have default names based on the alias name. They are named JANE.SF and JANE.RSA. If you want to be prompted for the store password and the private key password, then you could shorten the previous command to the following: jarsigner -keystore /working/mystore -signedjar sbundle.jar bundle.jar jane If the keystore is the default keystore (.keystore in your home directory), then you don't need to specify a keystore, as follows: jarsigner -signedjar sbundle.jar bundle.jar jane If you want the signed JAR file to overwrite the input JAR file (bundle.jar), then you don't need to specify a -signedjar option, as follows: jarsigner bundle.jar jane EXAMPLE OF VERIFYING A SIGNED JAR FILE To verify a signed JAR file to ensure that the signature is valid and the JAR file wasn't been tampered with, use a command such as the following: jarsigner -verify ButtonDemo.jar When the verification is successful, jar verified is displayed. Otherwise, an error message is displayed. You can get more information when you use the -verbose option. A sample use of jarsigner with the -verbose option follows: jarsigner -verify -verbose ButtonDemo.jar s 866 Tue Sep 12 20:08:48 EDT 2017 META-INF/MANIFEST.MF 825 Tue Sep 12 20:08:48 EDT 2017 META-INF/ORACLE_C.SF 7475 Tue Sep 12 20:08:48 EDT 2017 META-INF/ORACLE_C.RSA 0 Tue Sep 12 20:07:54 EDT 2017 META-INF/ 0 Tue Sep 12 20:07:16 EDT 2017 components/ 0 Tue Sep 12 20:07:16 EDT 2017 components/images/ sm 523 Tue Sep 12 20:07:16 EDT 2017 components/ButtonDemo$1.class sm 3440 Tue Sep 12 20:07:16 EDT 2017 components/ButtonDemo.class sm 2346 Tue Sep 12 20:07:16 EDT 2017 components/ButtonDemo.jnlp sm 172 Tue Sep 12 20:07:16 EDT 2017 components/images/left.gif sm 235 Tue Sep 12 20:07:16 EDT 2017 components/images/middle.gif sm 172 Tue Sep 12 20:07:16 EDT 2017 components/images/right.gif s = signature was verified m = entry is listed in manifest k = at least one certificate was found in keystore - Signed by "CN="Oracle America, Inc.", OU=Software Engineering, O="Oracle America, Inc.", L=Redwood City, ST=California, C=US" Digest algorithm: SHA-256 Signature algorithm: SHA256withRSA, 2048-bit key Timestamped by "CN=Symantec Time Stamping Services Signer - G4, O=Symantec Corporation, C=US" on Tue Sep 12 20:08:49 UTC 2017 Timestamp digest algorithm: SHA-1 Timestamp signature algorithm: SHA1withRSA, 2048-bit key jar verified. The signer certificate expired on 2018-02-01. However, the JAR will be valid until the timestamp expires on 2020-12-29. EXAMPLE OF VERIFICATION WITH CERTIFICATE INFORMATION If you specify the -certs option with the -verify and -verbose options, then the output includes certificate information for each signer of the JAR file. The information includes the certificate type, the signer distinguished name information (when it is an X.509 certificate), and in parentheses, the keystore alias for the signer when the public key certificate in the JAR file matches the one in a keystore entry, for example: jarsigner -keystore $JAVA_HOME/lib/security/cacerts -verify -verbose -certs ButtonDemo.jar s k 866 Tue Sep 12 20:08:48 EDT 2017 META-INF/MANIFEST.MF >>> Signer X.509, CN="Oracle America, Inc.", OU=Software Engineering, O="Oracle America, Inc.", L=Redwood City, ST=California, C=US [certificate is valid from 2017-01-30, 7:00 PM to 2018-02-01, 6:59 PM] X.509, CN=Symantec Class 3 SHA256 Code Signing CA, OU=Symantec Trust Network, O=Symantec Corporation, C=US [certificate is valid from 2013-12-09, 7:00 PM to 2023-12-09, 6:59 PM] X.509, CN=VeriSign Class 3 Public Primary Certification Authority - G5, OU="(c) 2006 VeriSign, Inc. - For authorized use only", OU=VeriSign Trust Network, O="VeriSign, Inc.", C=US (verisignclass3g5ca [jdk]) [trusted certificate] >>> TSA X.509, CN=Symantec Time Stamping Services Signer - G4, O=Symantec Corporation, C=US [certificate is valid from 2012-10-17, 8:00 PM to 2020-12-29, 6:59 PM] X.509, CN=Symantec Time Stamping Services CA - G2, O=Symantec Corporation, C=US [certificate is valid from 2012-12-20, 7:00 PM to 2020-12-30, 6:59 PM] 825 Tue Sep 12 20:08:48 EDT 2017 META-INF/ORACLE_C.SF 7475 Tue Sep 12 20:08:48 EDT 2017 META-INF/ORACLE_C.RSA 0 Tue Sep 12 20:07:54 EDT 2017 META-INF/ 0 Tue Sep 12 20:07:16 EDT 2017 components/ 0 Tue Sep 12 20:07:16 EDT 2017 components/images/ smk 523 Tue Sep 12 20:07:16 EDT 2017 components/ButtonDemo$1.class [entry was signed on 2017-09-12, 4:08 PM] >>> Signer X.509, CN="Oracle America, Inc.", OU=Software Engineering, O="Oracle America, Inc.", L=Redwood City, ST=California, C=US [certificate is valid from 2017-01-30, 7:00 PM to 2018-02-01, 6:59 PM] X.509, CN=Symantec Class 3 SHA256 Code Signing CA, OU=Symantec Trust Network, O=Symantec Corporation, C=US [certificate is valid from 2013-12-09, 7:00 PM to 2023-12-09, 6:59 PM] X.509, CN=VeriSign Class 3 Public Primary Certification Authority - G5, OU="(c) 2006 VeriSign, Inc. - For authorized use only", OU=VeriSign Trust Network, O="VeriSign, Inc.", C=US (verisignclass3g5ca [jdk]) [trusted certificate] >>> TSA X.509, CN=Symantec Time Stamping Services Signer - G4, O=Symantec Corporation, C=US [certificate is valid from 2012-10-17, 8:00 PM to 2020-12-29, 6:59 PM] X.509, CN=Symantec Time Stamping Services CA - G2, O=Symantec Corporation, C=US [certificate is valid from 2012-12-20, 7:00 PM to 2020-12-30, 6:59 PM] smk 3440 Tue Sep 12 20:07:16 EDT 2017 components/ButtonDemo.class ... smk 2346 Tue Sep 12 20:07:16 EDT 2017 components/ButtonDemo.jnlp ... smk 172 Tue Sep 12 20:07:16 EDT 2017 components/images/left.gif ... smk 235 Tue Sep 12 20:07:16 EDT 2017 components/images/middle.gif ... smk 172 Tue Sep 12 20:07:16 EDT 2017 components/images/right.gif ... s = signature was verified m = entry is listed in manifest k = at least one certificate was found in keystore - Signed by "CN="Oracle America, Inc.", OU=Software Engineering, O="Oracle America, Inc.", L=Redwood City, ST=California, C=US" Digest algorithm: SHA-256 Signature algorithm: SHA256withRSA, 2048-bit key Timestamped by "CN=Symantec Time Stamping Services Signer - G4, O=Symantec Corporation, C=US" on Tue Sep 12 20:08:49 UTC 2017 Timestamp digest algorithm: SHA-1 Timestamp signature algorithm: SHA1withRSA, 2048-bit key jar verified. The signer certificate expired on 2018-02-01. However, the JAR will be valid until the timestamp expires on 2020-12-29. If the certificate for a signer isn't an X.509 certificate, then there is no distinguished name information. In that case, just the certificate type and the alias are shown. For example, if the certificate is a PGP certificate, and the alias is bob, then you would get: PGP, (bob). JDK 22 2024 JARSIGNER(1)
jarsigner - sign and verify Java Archive (JAR) files
jarsigner [options] jar-file alias jarsigner -verify [options] jar-file [alias ...] jarsigner -version
The command-line options. See Options for jarsigner. -verify The -verify option can take zero or more keystore alias names after the JAR file name. When the -verify option is specified, the jarsigner command checks that the certificate used to verify each signed entry in the JAR file matches one of the keystore aliases. The aliases are defined in the keystore specified by -keystore or the default keystore. If you also specify the -strict option, and the jarsigner command detects severe warnings, the message, "jar verified, with signer errors" is displayed. jar-file The JAR file to be signed. If you also specified the -strict option, and the jarsigner command detected severe warnings, the message, "jar signed, with signer errors" is displayed. alias The aliases are defined in the keystore specified by -keystore or the default keystore. -version The -version option prints the program version of jarsigner.
null
jfr
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: --xml Print the recording in XML format. --json Print the recording in JSON format. --categories <filters> Select events matching a category name. The filter is a comma- separated list of names, simple and/or qualified, and/or quoted glob patterns. --events <filters> Select events matching an event name. The filter is a comma- separated list of names, simple and/or qualified, and/or quoted glob patterns. --stack-depth <depth> Number of frames in stack traces, by default 5. <file> 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: --verbose Displays the query that makes up the view. --width <integer> The width of the view in characters. Default value depends on the view. --truncate <mode> How to truncate content that exceeds space in a table cell. Mode can be 'beginning' or 'end'. Default value is 'end'. --cell-height <integer> Maximum number of rows in a table cell. Default value depends on the view. <view> Name of the view or event type to display. Use jfr --help view to see a list of available views. <file> 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 ] [--output ] [option=value]* [event-setting=value]* --interactive Interactive mode where the configuration is determined by a set of questions. --verbose Displays the modified settings. --input <files> 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. --output <file> The filename of the generated output file. If not specified, the filename custom.jfc will be used. option=value The option value to modify. To see available options, use jfr help configure event-setting=value 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 ] [--events ] [] --categories <filter> Select events matching a category name. The filter is a comma- separated list of names, simple and/or qualified, and/or quoted glob patterns. --events <filter> Select events matching an event name. The filter is a comma- separated list of names, simple and/or qualified, and/or quoted glob patterns. <file> Location of the recording file (.jfr) If the 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: <file> 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>] --include-events <filter> Select events matching an event name. --exclude-events <filter> Exclude events matching an event name. --include-categories <filter> Select events matching a category name. --exclude-categories <filter> Exclude events matching a category name. --include-threads <filter> Select events matching a thread name. --exclude-threads <filter> Exclude events matching a thread name. <input-file> The input file to read events from. <output-file> 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: <repository> Directory where the repository containing chunk files is located. <file> 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: --output <directory> The location to write the disassembled file, by default the current directory --max-chunks <chunks> Maximum number of chunks per file, by default 5. The chunk size varies, but is typically around 15 MB. --max-size <size> Maximum number of bytes per file. <file> 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 JDK 22 2024 JFR(1)
jfr - print and manipulate Flight Recorder files
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
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.
null
jdb
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 below. -tserver Runs the application in the Java HotSpot VM server. -Joption 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. The following options are forwarded to the debuggee process: -Roption 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. -v or -verbose[:class|gc|jni] Turns on the verbose mode. -Dname=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. JDK 22 2024 JDB(1)
jdb - find and fix bugs in Java platform programs
jdb [options] [classname] [arguments]
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.
null
jstack
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. JDK 22 2024 JSTACK(1)
jstack - print Java stack traces of Java threads for a specified Java process
Note: This command is experimental and unsupported. jstack [options] pid
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 command.
null
rmiregistry
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
rmiregistry - create and start a remote object registry on the specified port on the current host
rmiregistry [options] [port]
This represents the option for the rmiregistry command. See port The number of a port on the current host at which to start the remote object registry. -Joption Used with any Java option to pass the option following the -J (no spaces between the -J and the option) to the Java interpreter. JDK 22 2024 RMIREGISTRY(1)
null
jar
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. -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 Changes the specified directory and includes the files specified at the end of the command line. jar [OPTION ...] [ [--release VERSION] [-C dir] files] -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". 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. JDK 22 2024 JAR(1)
jar - create an archive for classes and resources, and manipulate or restore individual classes or resources from an archive
jar [OPTION ...] [ [--release VERSION] [-C dir] files] ...
null
null
jcmd
The jcmd utility is used to send diagnostic command requests to the JVM. It must be used on the same machine on which the JVM is running, and have the same effective user and group identifiers that were used to launch the JVM. Each diagnostic command has its own set of arguments. To display the description, syntax, and a list of available arguments for a diagnostic command, use the name of the command as the argument. For example: jcmd pid help command If arguments contain spaces, then you must surround them with single or double quotation marks (' or "). In addition, you must escape single or double quotation marks with a backslash (\) to prevent the operating system shell from processing quotation marks. Alternatively, you can surround these arguments with single quotation marks and then with double quotation marks (or with double quotation marks and then with single quotation marks). If you specify the process identifier (pid) or the main class (main- class) as the first argument, then the jcmd utility sends the diagnostic command request to the Java process with the specified identifier or to all Java processes with the specified name of the main class. You can also send the diagnostic command request to all available Java processes by specifying 0 as the process identifier. COMMANDS FOR JCMD The command must be a valid jcmd diagnostic command for the selected JVM. The list of available commands for jcmd is obtained by running the help command (jcmd pid help) where pid is the process ID for a running Java process. If the pid is 0, commands will be sent to all Java processes. The main class argument will be used to match, either partially or fully, the class used to start Java. If no options are given, it lists the running Java process identifiers that are not in separate docker processes along with the main class and command-line arguments that were used to launch the process (the same as using -l). The following commands are available: help [options] [arguments] For more information about a specific command. arguments: • command name: The name of the command for which we want help (STRING, no default value) Note: The following options must be specified using either key or key=value syntax. options: • -all: (Optional) Show help for all commands (BOOLEAN, false) . Compiler.CodeHeap_Analytics [function] [granularity] Print CodeHeap analytics Impact: Low: Depends on code heap size and content. Holds CodeCache_lock during analysis step, usually sub-second duration. arguments: • function: (Optional) Function to be performed (aggregate, UsedSpace, FreeSpace, MethodCount, MethodSpace, MethodAge, MethodNames, discard (STRING, all) • granularity: (Optional) Detail level - smaller value -> more detail (INT, 4096) Compiler.codecache Prints code cache layout and bounds. Impact: Low Compiler.codelist Prints all compiled methods in code cache that are alive. Impact: Medium Compiler.directives_add arguments Adds compiler directives from a file. Impact: Low arguments: • filename: The name of the directives file (STRING, no default value) Compiler.directives_clear Remove all compiler directives. Impact: Low Compiler.directives_print Prints all active compiler directives. Impact: Low Compiler.directives_remove Remove latest added compiler directive. Impact: Low Compiler.memory [options] Print compilation footprint Impact: Medium: Pause time depends on number of compiled methods Note: The options must be specified using either key or key=value syntax. options: • -H: (Optional) Human readable format (BOOLEAN, false) • -s: (Optional) Minimum memory size (MEMORY SIZE, 0) Compiler.perfmap (Linux only) Write map file for Linux perf tool. Impact: Low Compiler.queue Prints methods queued for compilation. Impact: Low GC.class_histogram [options] Provides statistics about the Java heap usage. Impact: High --- depends on Java heap size and content. Note: The options must be specified using either key or key=value syntax. options: • -all: (Optional) Inspects all objects, including unreachable objects (BOOLEAN, false) • -parallel: (Optional) Number of parallel threads to use for heap inspection. 0 (the default) means let the VM determine the number of threads to use. 1 means use one thread (disable parallelism). For any other value the VM will try to use the specified number of threads, but might use fewer. (INT, 0) GC.finalizer_info Provides information about the Java finalization queue. Impact: Medium GC.heap_dump [options] [arguments] Generates a HPROF format dump of the Java heap. Impact: High --- depends on the Java heap size and content. Request a full GC unless the -all option is specified. Note: The following options must be specified using either key or key=value syntax. options: • -all: (Optional) Dump all objects, including unreachable objects (BOOLEAN, false) • -gz: (Optional) If specified, the heap dump is written in gzipped format using the given compression level. 1 (recommended) is the fastest, 9 the strongest compression. (INT, 1) • -overwrite: (Optional) If specified, the dump file will be overwritten if it exists (BOOLEAN, false) • -parallel: (Optional) Number of parallel threads to use for heap dump. The VM will try to use the specified number of threads, but might use fewer. (INT, 1) arguments: • filename: The name of the dump file (STRING, no default value) GC.heap_info Provides generic Java heap information. Impact: Medium GC.run Calls java.lang.System.gc(). Impact: Medium --- depends on the Java heap size and content. GC.run_finalization Calls java.lang.System.runFinalization(). Impact: Medium --- depends on the Java content. JFR.check [options] Show information about a running flight recording Impact: Low Note: The options must be specified using either key or key=value syntax. If no parameters are entered, information for all active recordings is shown. options: • name: (Optional) Name of the flight recording. (STRING, no default value) • verbose: (Optional) Flag for printing the event settings for the recording (BOOLEAN, false) JFR.configure [options] Set the parameters for a flight recording Impact: Low Note: The options must be specified using either key or key=value syntax. If no parameters are entered, the current settings are displayed. options: • dumppath: (Optional) Path to the location where a recording file is written in case the VM runs into a critical error, such as a system crash. (STRING, The default location is the current directory) • globalbuffercount: (Optional) Number of global buffers. This option is a legacy option: change the memorysize parameter to alter the number of global buffers. This value cannot be changed once JFR has been initialized. (STRING, default determined by the value for memorysize) • globalbuffersize: (Optional) Size of the global buffers, in bytes. This option is a legacy option: change the memorysize parameter to alter the size of the global buffers. This value cannot be changed once JFR has been initialized. (STRING, default determined by the value for memorysize) • maxchunksize: (Optional) Maximum size of an individual data chunk in bytes if one of the following suffixes is not used: 'm' or 'M' for megabytes OR 'g' or 'G' for gigabytes. This value cannot be changed once JFR has been initialized. (STRING, 12M) • memorysize: (Optional) Overall memory size, in bytes if one of the following suffixes is not used: 'm' or 'M' for megabytes OR 'g' or 'G' for gigabytes. This value cannot be changed once JFR has been initialized. (STRING, 10M) • repositorypath: (Optional) Path to the location where recordings are stored until they are written to a permanent file. (STRING, The default location is the temporary directory for the operating system. On Linux operating systems, the temporary directory is /tmp. On Windwows, the temporary directory is specified by the TMP environment variable.) • preserve-repository={true|false} : Specifies whether files stored in the disk repository should be kept after the JVM has exited. If false, files are deleted. By default, this parameter is disabled. • stackdepth: (Optional) Stack depth for stack traces. Setting this value greater than the default of 64 may cause a performance degradation. This value cannot be changed once JFR has been initialized. (LONG, 64) • thread_buffer_size: (Optional) Local buffer size for each thread in bytes if one of the following suffixes is not used: 'k' or 'K' for kilobytes or 'm' or 'M' for megabytes. Overriding this parameter could reduce performance and is not recommended. This value cannot be changed once JFR has been initialized. (STRING, 8k) • samplethreads: (Optional) Flag for activating thread sampling. (BOOLEAN, true) JFR.dump [options] Write data to a file while a flight recording is running Impact: Low Note: The options must be specified using either key or key=value syntax. No options are required. The recording continues to run after the data is written. options: • begin: (Optional) Specify the time from which recording data will be included in the dump file. The format is specified as local time. (STRING, no default value) • end: (Optional) Specify the time to which recording data will be included in the dump file. The format is specified as local time. (STRING, no default value) Note: For both begin and end, the time must be in a format that can be read by java.time.LocalTime::parse(STRING), java.time.LocalDateTime::parse(STRING) or java.time.Instant::parse(STRING). For example, "13:20:15", "2020-03-17T09:00:00" or "2020-03-17T09:00:00Z". Note: begin and end times correspond to the timestamps found within the recorded information in the flight recording data. Another option is to use a time relative to the current time that is specified by a negative integer followed by "s", "m" or "h". For example, "-12h", "-15m" or "-30s" • filename: (Optional) Name of the file to which the flight recording data is dumped. If no filename is given, a filename is generated from the PID and the current date. The filename may also be a directory in which case, the filename is generated from the PID and the current date in the specified directory. If %p and/or %t is specified in the filename, it expands to the JVM's PID and the current timestamp, respectively. (STRING, no default value) • maxage: (Optional) Length of time for dumping the flight recording data to a file. (INTEGER followed by 's' for seconds 'm' for minutes or 'h' for hours, no default value) • maxsize: (Optional) Maximum size for the amount of data to dump from a flight recording in bytes if one of the following suffixes is not used: 'm' or 'M' for megabytes OR 'g' or 'G' for gigabytes. (STRING, no default value) • name: (Optional) Name of the recording. If no name is given, data from all recordings is dumped. (STRING, no default value) • path-to-gc-root: (Optional) Flag for saving the path to garbage collection (GC) roots at the time the recording data is dumped. The path information is useful for finding memory leaks but collecting it can cause the application to pause for a short period of time. Turn on this flag only when you have an application that you suspect has a memory leak. (BOOLEAN, false) JFR.start [options] Start a flight recording Impact: Low Note: The options must be specified using either key or key=value syntax. If no parameters are entered, then a recording is started with default values. options: • delay: (Optional) Length of time to wait before starting to record (INTEGER followed by 's' for seconds 'm' for minutes or 'h' for hours, 0s) • disk: (Optional) Flag for also writing the data to disk while recording (BOOLEAN, true) • dumponexit: (Optional) Flag for writing the recording to disk when the Java Virtual Machine (JVM) shuts down. If set to 'true' and no value is given for filename, the recording is written to a file in the directory where the process was started. The file name is a system-generated name that contains the process ID, the recording ID and the current time stamp. (For example: id-1-2019_12_12_10_41.jfr) (BOOLEAN, false) • duration: (Optional) Length of time to record. Note that 0s means forever (INTEGER followed by 's' for seconds 'm' for minutes or 'h' for hours, 0s) • filename: (Optional) Name of the file to which the flight recording data is written when the recording is stopped. If no filename is given, a filename is generated from the PID and the current date and is placed in the directory where the process was started. The filename may also be a directory in which case, the filename is generated from the PID and the current date in the specified directory. If %p and/or %t is specified in the filename, it expands to the JVM's PID and the current timestamp, respectively. (STRING, no default value) • maxage: (Optional) Maximum time to keep the recorded data on disk. This parameter is valid only when the disk parameter is set to true. Note 0s means forever. (INTEGER followed by 's' for seconds 'm' for minutes or 'h' for hours, 0s) • maxsize: (Optional) Maximum size of the data to keep on disk in bytes if one of the following suffixes is not used: 'm' or 'M' for megabytes OR 'g' or 'G' for gigabytes. This parameter is valid only when the disk parameter is set to 'true'. The value must not be less than the value for the maxchunksize parameter set with the JFR.configure command. (STRING, 0 (no maximum size)) • name: (Optional) Name of the recording. If no name is provided, a name is generated. Make note of the generated name that is shown in the response to the command so that you can use it with other commands. (STRING, system-generated default name) • path-to-gc-root: (Optional) Flag for saving the path to garbage collection (GC) roots at the end of a recording. The path information is useful for finding memory leaks but collecting it is time consuming. Turn on this flag only when you have an application that you suspect has a memory leak. If the settings parameter is set to 'profile', then the information collected includes the stack trace from where the potential leaking object was allocated. (BOOLEAN, false) • settings: (Optional) Name of the settings file that identifies which events to record. To specify more than one file, separate the names with a comma (','). Include the path if the file is not in JAVA-HOME/lib/jfr. The following profiles are included with the JDK in the JAVA-HOME/lib/jfr directory: 'default.jfc': collects a predefined set of information with low overhead, so it has minimal impact on performance and can be used with recordings that run continuously; 'profile.jfc': Provides more data than the 'default.jfc' profile, but with more overhead and impact on performance. Use this configuration for short periods of time when more information is needed. Use none to start a recording without a predefined configuration file. (STRING, JAVA-HOME/lib/jfr/default.jfc) Event settings and .jfc options can be specified using the following syntax: • option: (Optional) Specifies the option value to modify. To list available options, use the JAVA_HOME/bin/jfr tool. • event-setting: (Optional) Specifies 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 '+'. You can specify values for multiple event settings and .jfc options by separating them with a whitespace. In case of a conflict between a parameter and a .jfc option, the parameter will take precedence. 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.stop [options] Stop a flight recording Impact: Low Note: The options must be specified using either key or key=value syntax. If no parameters are entered, then no recording is stopped. options: • filename: (Optional) Name of the file to which the recording is written when the recording is stopped. If %p and/or %t is specified in the filename, it expands to the JVM's PID and the current timestamp, respectively. If no path is provided, the data from the recording is discarded. (STRING, no default value) • name: (Optional) Name of the recording (STRING, no default value) JVMTI.agent_load [arguments] Loads JVMTI native agent. Impact: Low arguments: • library path: Absolute path of the JVMTI agent to load. (STRING, no default value) • agent option: (Optional) Option string to pass the agent. (STRING, no default value) JVMTI.data_dump Signal the JVM to do a data-dump request for JVMTI. Impact: High ManagementAgent.start [options] Starts remote management agent. Impact: Low --- no impact Note: The following options must be specified using either key or key=value syntax. options: • config.file: (Optional) Sets com.sun.management.config.file (STRING, no default value) • jmxremote.host: (Optional) Sets com.sun.management.jmxremote.host (STRING, no default value) • jmxremote.port: (Optional) Sets com.sun.management.jmxremote.port (STRING, no default value) • jmxremote.rmi.port: (Optional) Sets com.sun.management.jmxremote.rmi.port (STRING, no default value) • jmxremote.ssl: (Optional) Sets com.sun.management.jmxremote.ssl (STRING, no default value) • jmxremote.registry.ssl: (Optional) Sets com.sun.management.jmxremote.registry.ssl (STRING, no default value) • jmxremote.authenticate: (Optional) Sets com.sun.management.jmxremote.authenticate (STRING, no default value) • jmxremote.password.file: (Optional) Sets com.sun.management.jmxremote.password.file (STRING, no default value) • jmxremote.access.file: (Optional) Sets com.sun.management.jmxremote.acce ss.file (STRING, no default value) • jmxremote.login.config: (Optional) Sets com.sun.management.jmxremote.log in.config (STRING, no default value) • jmxremote.ssl.enabled.cipher.suites: (Optional) Sets com.sun.management. • jmxremote.ssl.enabled.cipher.suite: (STRING, no default value) • jmxremote.ssl.enabled.protocols: (Optional) Sets com.sun.management.jmxr emote.ssl.enabled.protocols (STRING, no default value) • jmxremote.ssl.need.client.auth: (Optional) Sets com.sun.management.jmxre mote.need.client.auth (STRING, no default value) • jmxremote.ssl.config.file: (Optional) Sets com.sun.management.jmxremote. ssl_config_file (STRING, no default value) • jmxremote.autodiscovery: (Optional) Sets com.sun.management.jmxremote.au todiscovery (STRING, no default value) • jdp.port: (Optional) Sets com.sun.management.jdp.port (INT, no default value) • jdp.address: (Optional) Sets com.sun.management.jdp.address (STRING, no default value) • jdp.source_addr: (Optional) Sets com.sun.management.jdp.source_addr (STRING, no default value) • jdp.ttl: (Optional) Sets com.sun.management.jdp.ttl (INT, no default value) • jdp.pause: (Optional) Sets com.sun.management.jdp.pause (INT, no default value) • jdp.name: (Optional) Sets com.sun.management.jdp.name (STRING, no default value) ManagementAgent.start_local Starts the local management agent. Impact: Low --- no impact ManagementAgent.status Print the management agent status. Impact: Low --- no impact ManagementAgent.stop Stops the remote management agent. Impact: Low --- no impact System.dump_map [options] (Linux only) Dumps an annotated process memory map to an output file. Impact: Low Note: The following options must be specified using either key or key=value syntax. options: • -H: (Optional) Human readable format (BOOLEAN, false) • -F: (Optional) File path (STRING, "vm_memory_map_.txt") System.map [options] (Linux only) Prints an annotated process memory map of the VM process. Impact: Low Note: The following options must be specified using either key or key=value syntax. options: • -H: (Optional) Human readable format (BOOLEAN, false) System.native_heap_info (Linux only) Attempts to output information regarding native heap usage through malloc_info(3). If unsuccessful outputs "Error: " and a reason. Impact: Low System.trim_native_heap (Linux only) Attempts to free up memory by trimming the C-heap. Impact: Low Thread.dump_to_file [options] filepath Dump threads, with stack traces, to a file in plain text or JSON format. Impact: Medium: Depends on the number of threads. Note: The following options must be specified using either key or key=value syntax. options: • -overwrite: (Optional) May overwrite existing file (BOOLEAN, false) • -format: (Optional) Output format ("plain" or "json") (STRING, plain) arguments: • filepath: The file path to the output file (STRING, no default value) Thread.print [options] Prints all threads with stacktraces. Impact: Medium --- depends on the number of threads. Note: The following options must be specified using either key or key=value syntax. options: • -e: (Optional) Print extended thread information (BOOLEAN, false) • -l: (Optional) Prints java.util.concurrent locks (BOOLEAN, false) VM.cds [arguments] Dump a static or dynamic shared archive that includes all currently loaded classes. Impact: Medium --- pause time depends on number of loaded classes arguments: • subcmd: must be either static_dump or dynamic_dump (STRING, no default value) • filename: (Optional) Name of the shared archive to be dumped (STRING, no default value) If filename is not specified, a default file name is chosen using the pid of the target JVM process. For example, java_pid1234_static.jsa, java_pid5678_dynamic.jsa, etc. If filename is not specified as an absolute path, the archive file is created in a directory relative to the current directory of the target JVM process. If dynamic_dump is specified, the target JVM must be started with the JVM option -XX:+RecordDynamicDumpInfo. VM.class_hierarchy [options] [arguments] Print a list of all loaded classes, indented to show the class hierarchy. The name of each class is followed by the ClassLoaderData* of its ClassLoader, or "null" if it is loaded by the bootstrap class loader. Impact: Medium --- depends on the number of loaded classes. Note: The following options must be specified using either key or key=value syntax. options: • -i: (Optional) Inherited interfaces should be printed. (BOOLEAN, false) • -s: (Optional) If a classname is specified, print its subclasses in addition to its superclasses. Without this option only the superclasses will be printed. (BOOLEAN, false) arguments: • classname: (Optional) The name of the class whose hierarchy should be printed. If not specified, all class hierarchies are printed. (STRING, no default value) VM.classes [options] Print all loaded classes Impact: Medium: Depends on number of loaded classes. The following options must be specified using either key or key=value syntax. options: • -verbose: (Optional) Dump the detailed content of a Java class. Some classes are annotated with flags: F = has, or inherits, a non-empty finalize method, f = has final method, W = methods rewritten, C = marked with @Contended annotation, R = has been redefined, S = is shared class (BOOLEAN, false) VM.classloader_stats Print statistics about all ClassLoaders. Impact: Low VM.classloaders [options] Prints classloader hierarchy. Impact: Medium --- Depends on number of class loaders and classes loaded. The following options must be specified using either key or key=value syntax. options: • show-classes: (Optional) Print loaded classes. (BOOLEAN, false) • verbose: (Optional) Print detailed information. (BOOLEAN, false) • fold: (Optional) Show loaders of the same name and class as one. (BOOLEAN, true) VM.command_line Print the command line used to start this VM instance. Impact: Low VM.dynlibs Print loaded dynamic libraries. Impact: Low VM.events [options] Print VM event logs Impact: Low --- Depends on event log size. options: Note: The following options must be specified using either key or key=value syntax. • log: (Optional) Name of log to be printed. If omitted, all logs are printed. (STRING, no default value) • max: (Optional) Maximum number of events to be printed (newest first). If omitted, all events are printed. (STRING, no default value) VM.flags [options] Print the VM flag options and their current values. Impact: Low Note: The following options must be specified using either key or key=value syntax. options: • -all: (Optional) Prints all flags supported by the VM (BOOLEAN, false). VM.info Print information about the JVM environment and status. Impact: Low VM.log [options] Lists current log configuration, enables/disables/configures a log output, or rotates all logs. Impact: Low options: Note: The following options must be specified using either key or key=value syntax. • output: (Optional) The name or index (#) of output to configure. (STRING, no default value) • output_options: (Optional) Options for the output. (STRING, no default value) • what: (Optional) Configures what tags to log. (STRING, no default value ) • decorators: (Optional) Configures which decorators to use. Use 'none' or an empty value to remove all. (STRING, no default value) • disable: (Optional) Turns off all logging and clears the log configuration. (BOOLEAN, no default value) • list: (Optional) Lists current log configuration. (BOOLEAN, no default value) • rotate: (Optional) Rotates all logs. (BOOLEAN, no default value) VM.metaspace [options] Prints the statistics for the metaspace Impact: Medium --- Depends on number of classes loaded. Note: The following options must be specified using either key or key=value syntax. options: • basic: (Optional) Prints a basic summary (does not need a safepoint). (BOOLEAN, false) • show-loaders: (Optional) Shows usage by class loader. (BOOLEAN, false) • show-classes: (Optional) If show-loaders is set, shows loaded classes for each loader. (BOOLEAN, false) • by-chunktype: (Optional) Break down numbers by chunk type. (BOOLEAN, false) • by-spacetype: (Optional) Break down numbers by loader type. (BOOLEAN, false) • vslist: (Optional) Shows details about the underlying virtual space. (BOOLEAN, false) • chunkfreelist: (Optional) Shows details about global chunk free lists (ChunkManager). (BOOLEAN, false) • scale: (Optional) Memory usage in which to scale. Valid values are: 1, KB, MB or GB (fixed scale) or "dynamic" for a dynamically chosen scale. (STRING, dynamic) VM.native_memory [options] Print native memory usage Impact: Medium Note: The following options must be specified using either key or key=value syntax. options: • summary: (Optional) Requests runtime to report current memory summary, which includes total reserved and committed memory, along with memory usage summary by each subsystem. (BOOLEAN, false) • detail: (Optional) Requests runtime to report memory allocation >= 1K by each callsite. (BOOLEAN, false) • baseline: (Optional) Requests runtime to baseline current memory usage, so it can be compared against in later time. (BOOLEAN, false) • summary.diff: (Optional) Requests runtime to report memory summary comparison against previous baseline. (BOOLEAN, false) • detail.diff: (Optional) Requests runtime to report memory detail comparison against previous baseline, which shows the memory allocation activities at different callsites. (BOOLEAN, false) • statistics: (Optional) Prints tracker statistics for tuning purpose. (BOOLEAN, false) • scale: (Optional) Memory usage in which scale, KB, MB or GB (STRING, KB) VM.set_flag [arguments] Sets VM flag option using the provided value. Impact: Low arguments: • flag name: The name of the flag that you want to set (STRING, no default value) • string value: (Optional) The value that you want to set (STRING, no default value) VM.stringtable [options] Dump string table. Impact: Medium --- depends on the Java content. Note: The following options must be specified using either key or key=value syntax. options: • -verbose: (Optional) Dumps the content of each string in the table (BOOLEAN, false) VM.symboltable [options] Dump symbol table. Impact: Medium --- depends on the Java content. Note: The following options must be specified using either key or key=value syntax). options: • -verbose: (Optional) Dumps the content of each symbol in the table (BOOLEAN, false) VM.system_properties Print system properties. Impact: Low VM.systemdictionary Prints the statistics for dictionary hashtable sizes and bucket length. Impact: Medium Note: The following options must be specified using either key or key=value syntax. options: • verbose: (Optional) Dump the content of each dictionary entry for all class loaders (BOOLEAN, false) . VM.uptime [options] Print VM uptime. Impact: Low Note: The following options must be specified using either key or key=value syntax. options: • -date: (Optional) Adds a prefix with the current date (BOOLEAN, false) VM.version Print JVM version information. Impact: Low JDK 22 2024 JCMD(1)
jcmd - send diagnostic command requests to a running Java Virtual Machine (JVM)
jcmd [pid | main-class] command... | PerfCounter.print | -f filename jcmd [-l] jcmd -h pid When used, the jcmd utility sends the diagnostic command request to the process ID for the Java process. main-class When used, the jcmd utility sends the diagnostic command request to all Java processes with the specified name of the main class. command The command must be a valid jcmd command for the selected JVM. The list of available commands for jcmd is obtained by running the help command (jcmd pid help) where pid is the process ID for the running Java process. If the pid is 0, commands will be sent to all Java processes. The main class argument will be used to match, either partially or fully, the class used to start Java. If no options are given, it lists the running Java process identifiers with the main class and command-line arguments that were used to launch the process (the same as using -l). Perfcounter.print Prints the performance counters exposed by the specified Java process. -f filename Reads and executes commands from a specified file, filename. -l Displays the list of Java Virtual Machine process identifiers that are not running in a separate docker process along with the main class and command-line arguments that were used to launch the process. If the JVM is in a docker process, you must use tools such as ps to look up the PID. Note: Using jcmd without arguments is the same as using jcmd -l. -h Displays the jcmd utility's command-line help.
null
null
jrunscript
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. -Dname=value Sets a Java system property. -Jflag 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 JDK 22 2024 JRUNSCRIPT(1)
jrunscript - run a command-line script shell that supports interactive and batch modes
Note: This tool is experimental and unsupported. jrunscript [options] [arguments]
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.
null
jps
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 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.
jps - list the instrumented JVMs on the target system
Note: This command is experimental and unsupported. jps [-q] [-mlvV] [hostid] jps [-help]
-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.
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 JDK 22 2024 JPS(1)
java
The java command starts a Java application. It does this by starting the Java Virtual Machine (JVM), loading the specified class, and calling that class's main() method. The method must be declared public and static, it must not return any value, and it must accept a String array as a parameter. The method declaration has the following form: public static void main(String[] args) In source-file mode, the java command can launch a class declared in a source file. See Using Source-File Mode to Launch Source-Code Programs for a description of using the source-file mode. Note: You can use the JDK_JAVA_OPTIONS launcher environment variable to prepend its content to the actual command line of the java launcher. See Using the JDK_JAVA_OPTIONS Launcher Environment Variable. By default, the first argument that isn't an option of the java command is the fully qualified name of the class to be called. If -jar is specified, then its argument is the name of the JAR file containing class and resource files for the application. The startup class must be indicated by the Main-Class manifest header in its manifest file. Arguments after the class file name or the JAR file name are passed to the main() method. javaw Windows: The javaw command is identical to java, except that with javaw there's no associated console window. Use javaw when you don't want a command prompt window to appear. The javaw launcher will, however, display a dialog box with error information if a launch fails. USING SOURCE-FILE MODE TO LAUNCH SOURCE-CODE PROGRAMS To launch a class declared in a source file, run the java launcher in source-file mode. Entering source-file mode is determined by two items on the java command line: • The first item on the command line that is not an option or part of an option. In other words, the item in the command line that would otherwise be the main class name. • The --source version option, if present. If the class identifies an existing file that has a .java extension, or if the --source option is specified, then source-file mode is selected. The source file is then compiled and run. The --source option can be used to specify the source version or N of the source code. This determines the API that can be used. When you set --source N, you can only use the public API that was defined in JDK N. Note: The valid values of N change for each release, with new values added and old values removed. You'll get an error message if you use a value of N that is no longer supported. The supported values of N are the current Java SE release (22) and a limited number of previous releases, detailed in the command-line help for javac, under the --source and --release options. If the file does not have the .java extension, the --source option must be used to tell the java command to use the source-file mode. The --source option is used for cases when the source file is a "script" to be executed and the name of the source file does not follow the normal naming conventions for Java source files. In source-file mode, the effect is as though the source file is compiled into memory, and the first class found in the source file is executed. Any arguments placed after the name of the source file in the original command line are passed to the compiled class when it is executed. For example, if a file were named HelloWorld.java and contained a class named HelloWorld, then the source-file mode command to launch the class would be: java HelloWorld.java This use of source-file mode is informally equivalent to using the following two commands: javac -d <memory> --source-path <source-root> HelloWorld.java java --class-path <memory> HelloWorld where <source-root> is computed In source-file mode, any additional command-line options are processed as follows: • The launcher scans the options specified before the source file for any that are relevant in order to compile the source file. This includes: --class-path, --module-path, --add-exports, --add-modules, --limit-modules, --patch-module, --upgrade-module-path, and any variant forms of those options. It also includes the new --enable-preview option, described in JEP 12. • No provision is made to pass any additional options to the compiler, such as -processor or -Werror. • Command-line argument files (@-files) may be used in the standard way. Long lists of arguments for either the VM or the program being invoked may be placed in files specified on the command-line by prefixing the filename with an @ character. In source-file mode, compilation proceeds as follows: • Any command-line options that are relevant to the compilation environment are taken into account. These include: --class-path/-classpath/-cp, --module-path/-p, --add-exports, --add-modules, --limit-modules, --patch-module, --upgrade-module-path, --enable-preview. • The root of the source tree, <source-root> is computed from the package of the class being launched. For example, if HelloWorld.java declared its classes to be in the hello package, then the file HelloWorld.java is expected to reside in the directory somedir/hello/. In this case, somedir is computed to be the root of the source tree. • The root of the source tree serves as the source-path for compilation, so that other source files found in that tree and are needed by HelloWorld could be compiled. • Annotation processing is disabled, as if -proc:none is in effect. • If a version is specified, via the --source option, the value is used as the argument for an implicit --release option for the compilation. This sets both the source version accepted by compiler and the system API that may be used by the code in the source file. • If a module-info.java file exists in the <source-root> directory, its module declaration is used to define a named module that will contain all the classes compiled from .java files in the source tree. If module-info.java does not exist, all the classes compiled from source files will be compiled in the context of the unnamed module. • The source file that is launched should contain one or more top-level classes, the first of which is taken as the class to be executed. • For the source file that is launched, the compiler does not enforce the optional restriction defined at the end of JLS 7.6, that a type in a named package should exist in a file whose name is composed from the type name followed by the .java extension. • If a source file contains errors, appropriate error messages are written to the standard error stream, and the launcher exits with a non-zero exit code. In source-file mode, execution proceeds as follows: • The class to be executed is the first top-level class found in the source file. It must contain a declaration of an entry main method. • The compiled classes are loaded by a custom class loader, that delegates to the application class loader. This implies that classes appearing on the application class path cannot refer to any classes declared in source files. • If a module-info.java file exists in the <source-root> directory, then all the classes compiled from .java files in the source tree will be in that module, which will serve as the root module for the execution of the program. If module-info.java does not exist, the compiled classes are executed in the context of an unnamed module, as though --add-modules=ALL-DEFAULT is in effect. This is in addition to any other --add-module options that may be have been specified on the command line. • Any arguments appearing after the name of the file on the command line are passed to the main method in the obvious way. • It is an error if there is a class on the application class path whose name is the same as that of the class to be executed. See JEP 458: Launch Multi-File Source-Code Programs [https://openjdk.org/jeps/458] for complete details. USING THE JDK_JAVA_OPTIONS LAUNCHER ENVIRONMENT VARIABLE JDK_JAVA_OPTIONS prepends its content to the options parsed from the command line. The content of the JDK_JAVA_OPTIONS environment variable is a list of arguments separated by white-space characters (as determined by isspace()). These are prepended to the command line arguments passed to java launcher. The encoding requirement for the environment variable is the same as the java command line on the system. JDK_JAVA_OPTIONS environment variable content is treated in the same manner as that specified in the command line. Single (') or double (") quotes can be used to enclose arguments that contain whitespace characters. All content between the open quote and the first matching close quote are preserved by simply removing the pair of quotes. In case a matching quote is not found, the launcher will abort with an error message. @-files are supported as they are specified in the command line. However, as in @-files, use of a wildcard is not supported. In order to mitigate potential misuse of JDK_JAVA_OPTIONS behavior, options that specify the main class (such as -jar) or cause the java launcher to exit without executing the main class (such as -h) are disallowed in the environment variable. If any of these options appear in the environment variable, the launcher will abort with an error message. When JDK_JAVA_OPTIONS is set, the launcher prints a message to stderr as a reminder. Example: $ export JDK_JAVA_OPTIONS='-g @file1 -Dprop=value @file2 -Dws.prop="white spaces"' $ java -Xint @file3 is equivalent to the command line: java -g @file1 -Dprop=value @file2 -Dws.prop="white spaces" -Xint @file3 OVERVIEW OF JAVA OPTIONS The java command supports a wide range of options in the following categories: • Standard Options for Java: Options guaranteed to be supported by all implementations of the Java Virtual Machine (JVM). They're used for common actions, such as checking the version of the JRE, setting the class path, enabling verbose output, and so on. • Extra Options for Java: General purpose options that are specific to the Java HotSpot Virtual Machine. They aren't guaranteed to be supported by all JVM implementations, and are subject to change. These options start with -X. The advanced options aren't recommended for casual use. These are developer options used for tuning specific areas of the Java HotSpot Virtual Machine operation that often have specific system requirements and may require privileged access to system configuration parameters. Several examples of performance tuning are provided in Performance Tuning Examples. These options aren't guaranteed to be supported by all JVM implementations and are subject to change. Advanced options start with -XX. • Advanced Runtime Options for Java: Control the runtime behavior of the Java HotSpot VM. • Advanced JIT Compiler Options for java: Control the dynamic just-in- time (JIT) compilation performed by the Java HotSpot VM. • Advanced Serviceability Options for Java: Enable gathering system information and performing extensive debugging. • Advanced Garbage Collection Options for Java: Control how garbage collection (GC) is performed by the Java HotSpot Boolean options are used to either enable a feature that's disabled by default or disable a feature that's enabled by default. Such options don't require a parameter. Boolean -XX options are enabled using the plus sign (-XX:+OptionName) and disabled using the minus sign (-XX:-OptionName). For options that require an argument, the argument may be separated from the option name by a space, a colon (:), or an equal sign (=), or the argument may directly follow the option (the exact syntax differs for each option). If you're expected to specify the size in bytes, then you can use no suffix, or use the suffix k or K for kilobytes (KB), m or M for megabytes (MB), or g or G for gigabytes (GB). For example, to set the size to 8 GB, you can specify either 8g, 8192m, 8388608k, or 8589934592 as the argument. If you are expected to specify the percentage, then use a number from 0 to 1. For example, specify 0.25 for 25%. The following sections describe the options that are deprecated, obsolete, and removed: • Deprecated Java Options: Accepted and acted upon --- a warning is issued when they're used. • Obsolete Java Options: Accepted but ignored --- a warning is issued when they're used. • Removed Java Options: Removed --- using them results in an error. STANDARD OPTIONS FOR JAVA These are the most commonly used options supported by all implementations of the JVM. Note: To specify an argument for a long option, you can use either --name=value or --name value. -agentlib:libname[=options] Loads the specified native agent library. After the library name, a comma-separated list of options specific to the library can be used. If the option -agentlib:foo is specified, then the JVM attempts to load the library named foo using the platform specific naming conventions and locations: • Linux and other POSIX-like platforms: The JVM attempts to load the library named libfoo.so in the location specified by the LD_LIBRARY_PATH system variable. • macOS: The JVM attempts to load the library named libfoo.dylib in the location specified by the DYLD_LIBRARY_PATH system variable. • Windows: The JVM attempts to load the library named foo.dll in the location specified by the PATH system variable. The following example shows how to load the Java Debug Wire Protocol (JDWP) library and listen for the socket connection on port 8000, suspending the JVM before the main class loads: -agentlib:jdwp=transport=dt_socket,server=y,address=8000 -agentpath:pathname[=options] Loads the native agent library specified by the absolute path name. This option is equivalent to -agentlib but uses the full path and file name of the library. --class-path classpath, -classpath classpath, or -cp classpath Specifies a list of directories, JAR files, and ZIP archives to search for class files. On Windows, semicolons (;) separate entities in this list; on other platforms it is a colon (:). Specifying classpath overrides any setting of the CLASSPATH environment variable. If the class path option isn't used and classpath isn't set, then the user class path consists of the current directory (.). As a special convenience, a class path element that contains a base name of an asterisk (*) is considered equivalent to specifying a list of all the files in the directory with the extension .jar or .JAR . A Java program can't tell the difference between the two invocations. For example, if the directory mydir contains a.jar and b.JAR, then the class path element mydir/* is expanded to A.jar:b.JAR, except that the order of JAR files is unspecified. All .jar files in the specified directory, even hidden ones, are included in the list. A class path entry consisting of an asterisk (*) expands to a list of all the jar files in the current directory. The CLASSPATH environment variable, where defined, is similarly expanded. Any class path wildcard expansion that occurs before the Java VM is started. Java programs never see wildcards that aren't expanded except by querying the environment, such as by calling System.getenv("CLASSPATH"). --disable-@files Can be used anywhere on the command line, including in an argument file, to prevent further @filename expansion. This option stops expanding @-argfiles after the option. --enable-preview Allows classes to depend on preview features [https://docs.oracle.com/en/java/javase/12/language/index.html#JSLAN- GUID-5A82FE0E-0CA4-4F1F-B075-564874FE2823] of the release. --enable-native-access module[,module...] Native access involves access to code or data outside the Java runtime. This is generally unsafe and, if done incorrectly, might crash the JVM or result in memory corruption. Methods that provide native access are restricted, and by default their use causes warnings. This option allows code in the specified modules to use restricted methods without warnings. module can be ALL-UNNAMED to indicate code on the class path. When this option is present, any use of restricted methods by code outside the specified modules causes an IllegalCallerException. --finalization=value Controls whether the JVM performs finalization of objects. Valid values are "enabled" and "disabled". Finalization is enabled by default, so the value "enabled" does nothing. The value "disabled" disables finalization, so that no finalizers are invoked. --module-path modulepath... or -p modulepath Specifies where to find application modules with a list of path elements. The elements of a module path can be a file path to a module or a directory containing modules. Each module is either a modular JAR or an exploded-module directory. On Windows, semicolons (;) separate path elements in this list; on other platforms it is a colon (:). --upgrade-module-path modulepath... Specifies where to find module replacements of upgradeable modules in the runtime image with a list of path elements. The elements of a module path can be a file path to a module or a directory containing modules. Each module is either a modular JAR or an exploded-module directory. On Windows, semicolons (;) separate path elements in this list; on other platforms it is a colon (:). --add-modules module[,module...] Specifies the root modules to resolve in addition to the initial module. module can also be ALL-DEFAULT, ALL-SYSTEM, and ALL-MODULE-PATH. --list-modules Lists the observable modules and then exits. -d module_name or --describe-module module_name Describes a specified module and then exits. --dry-run Creates the VM but doesn't execute the main method. This --dry-run option might be useful for validating the command-line options such as the module system configuration. --validate-modules Validates all modules and exit. This option is helpful for finding conflicts and other errors with modules on the module path. -Dproperty=value Sets a system property value. The property variable is a string with no spaces that represents the name of the property. The value variable is a string that represents the value of the property. If value is a string with spaces, then enclose it in quotation marks (for example -Dfoo="foo bar"). -disableassertions[:[packagename]...|:classname] or -da[:[packagename]...|:classname] Disables assertions. By default, assertions are disabled in all packages and classes. With no arguments, -disableassertions (-da) disables assertions in all packages and classes. With the packagename argument ending in ..., the switch disables assertions in the specified package and any subpackages. If the argument is simply ..., then the switch disables assertions in the unnamed package in the current working directory. With the classname argument, the switch disables assertions in the specified class. The -disableassertions (-da) option applies to all class loaders and to system classes (which don't have a class loader). There's one exception to this rule: If the option is provided with no arguments, then it doesn't apply to system classes. This makes it easy to disable assertions in all classes except for system classes. The -disablesystemassertions option enables you to disable assertions in all system classes. To explicitly enable assertions in specific packages or classes, use the -enableassertions (-ea) option. Both options can be used at the same time. For example, to run the MyClass application with assertions enabled in the package com.wombat.fruitbat (and any subpackages) but disabled in the class com.wombat.fruitbat.Brickbat, use the following command: java -ea:com.wombat.fruitbat... -da:com.wombat.fruitbat.Brickbat MyClass -disablesystemassertions or -dsa Disables assertions in all system classes. -enableassertions[:[packagename]...|:classname] or -ea[:[packagename]...|:classname] Enables assertions. By default, assertions are disabled in all packages and classes. With no arguments, -enableassertions (-ea) enables assertions in all packages and classes. With the packagename argument ending in ..., the switch enables assertions in the specified package and any subpackages. If the argument is simply ..., then the switch enables assertions in the unnamed package in the current working directory. With the classname argument, the switch enables assertions in the specified class. The -enableassertions (-ea) option applies to all class loaders and to system classes (which don't have a class loader). There's one exception to this rule: If the option is provided with no arguments, then it doesn't apply to system classes. This makes it easy to enable assertions in all classes except for system classes. The -enablesystemassertions option provides a separate switch to enable assertions in all system classes. To explicitly disable assertions in specific packages or classes, use the -disableassertions (-da) option. If a single command contains multiple instances of these switches, then they're processed in order, before loading any classes. For example, to run the MyClass application with assertions enabled only in the package com.wombat.fruitbat (and any subpackages) but disabled in the class com.wombat.fruitbat.Brickbat, use the following command: java -ea:com.wombat.fruitbat... -da:com.wombat.fruitbat.Brickbat MyClass -enablesystemassertions or -esa Enables assertions in all system classes. -help, -h, or -? Prints the help message to the error stream. --help Prints the help message to the output stream. -javaagent:jarpath[=options] Loads the specified Java programming language agent. See java.lang.instrument. --show-version Prints the product version to the output stream and continues. -showversion Prints the product version to the error stream and continues. --show-module-resolution Shows module resolution output during startup. -splash:imagepath Shows the splash screen with the image specified by imagepath. HiDPI scaled images are automatically supported and used if available. The unscaled image file name, such as image.ext, should always be passed as the argument to the -splash option. The most appropriate scaled image provided is picked up automatically. For example, to show the splash.gif file from the images directory when starting your application, use the following option: -splash:images/splash.gif See the SplashScreen API documentation for more information. -verbose:class Displays information about each loaded class. -verbose:gc Displays information about each garbage collection (GC) event. -verbose:jni Displays information about the use of native methods and other Java Native Interface (JNI) activity. -verbose:module Displays information about the modules in use. --version Prints product version to the output stream and exits. -version Prints product version to the error stream and exits. -X Prints the help on extra options to the error stream. --help-extra Prints the help on extra options to the output stream. @argfile Specifies one or more argument files prefixed by @ used by the java command. It isn't uncommon for the java command line to be very long because of the .jar files needed in the classpath. The @argfile option overcomes command-line length limitations by enabling the launcher to expand the contents of argument files after shell expansion, but before argument processing. Contents in the argument files are expanded because otherwise, they would be specified on the command line until the --disable-@files option was encountered. The argument files can also contain the main class name and all options. If an argument file contains all of the options required by the java command, then the command line could simply be: java @argfile See java Command-Line Argument Files for a description and examples of using @-argfiles. EXTRA OPTIONS FOR JAVA The following java options are general purpose options that are specific to the Java HotSpot Virtual Machine. -Xbatch Disables background compilation. By default, the JVM compiles the method as a background task, running the method in interpreter mode until the background compilation is finished. The -Xbatch flag disables background compilation so that compilation of all methods proceeds as a foreground task until completed. This option is equivalent to -XX:-BackgroundCompilation. -Xbootclasspath/a:directories|zip|JAR-files Specifies a list of directories, JAR files, and ZIP archives to append to the end of the default bootstrap class path. On Windows, semicolons (;) separate entities in this list; on other platforms it is a colon (:). -Xcheck:jni Performs additional checks for Java Native Interface (JNI) functions. The following checks are considered indicative of significant problems with the native code, and the JVM terminates with an irrecoverable error in such cases: • The thread doing the call is not attached to the JVM. • The thread doing the call is using the JNIEnv belonging to another thread. • A parameter validation check fails: • A jfieldID, or jmethodID, is detected as being invalid. For example: • Of the wrong type • Associated with the wrong class • A parameter of the wrong type is detected. • An invalid parameter value is detected. For example: • NULL where not permitted • An out-of-bounds array index, or frame capacity • A non-UTF-8 string • An invalid JNI reference • An attempt to use a ReleaseXXX function on a parameter not produced by the corresponding GetXXX function The following checks only result in warnings being printed: • A JNI call was made without checking for a pending exception from a previous JNI call, and the current call is not safe when an exception may be pending. • A class descriptor is in decorated format (Lname;) when it should not be. • A NULL parameter is allowed, but its use is questionable. • Calling other JNI functions in the scope of Get/ReleasePrimitiveArrayCritical or Get/ReleaseStringCritical Expect a performance degradation when this option is used. -Xcomp Testing mode to exercise JIT compilers. This option should not be used in production environments. -Xdebug Does nothing; deprecated for removal in a future release. -Xdiag Shows additional diagnostic messages. -Xint Runs the application in interpreted-only mode. Compilation to native code is disabled, and all bytecode is executed by the interpreter. The performance benefits offered by the just-in- time (JIT) compiler aren't present in this mode. -Xinternalversion Displays more detailed JVM version information than the -version option, and then exits. -Xlog:option Configure or enable logging with the Java Virtual Machine (JVM) unified logging framework. See Enable Logging with the JVM Unified Logging Framework. -Xmixed Executes all bytecode by the interpreter except for hot methods, which are compiled to native code. On by default. Use -Xint to switch off. -Xmn size Sets the initial and maximum size (in bytes) of the heap for the young generation (nursery) in the generational collectors. Append the letter k or K to indicate kilobytes, m or M to indicate megabytes, or g or G to indicate gigabytes. The young generation region of the heap is used for new objects. GC is performed in this region more often than in other regions. If the size for the young generation is too small, then a lot of minor garbage collections are performed. If the size is too large, then only full garbage collections are performed, which can take a long time to complete. It is recommended that you do not set the size for the young generation for the G1 collector, and keep the size for the young generation greater than 25% and less than 50% of the overall heap size for other collectors. The following examples show how to set the initial and maximum size of young generation to 256 MB using various units: -Xmn256m -Xmn262144k -Xmn268435456 Instead of the -Xmn option to set both the initial and maximum size of the heap for the young generation, you can use -XX:NewSize to set the initial size and -XX:MaxNewSize to set the maximum size. -Xms size Sets the minimum and the initial size (in bytes) of the heap. This value must be a multiple of 1024 and greater than 1 MB. Append the letter k or K to indicate kilobytes, m or M to indicate megabytes, or g or G to indicate gigabytes. The following examples show how to set the size of allocated memory to 6 MB using various units: -Xms6291456 -Xms6144k -Xms6m If you do not set this option, then the initial size will be set as the sum of the sizes allocated for the old generation and the young generation. The initial size of the heap for the young generation can be set using the -Xmn option or the -XX:NewSize option. Note that the -XX:InitialHeapSize option can also be used to set the initial heap size. If it appears after -Xms on the command line, then the initial heap size gets set to the value specified with -XX:InitialHeapSize. -Xmx size Specifies the maximum size (in bytes) of the heap. This value must be a multiple of 1024 and greater than 2 MB. Append the letter k or K to indicate kilobytes, m or M to indicate megabytes, or g or G to indicate gigabytes. The default value is chosen at runtime based on system configuration. For server deployments, -Xms and -Xmx are often set to the same value. The following examples show how to set the maximum allowed size of allocated memory to 80 MB using various units: -Xmx83886080 -Xmx81920k -Xmx80m The -Xmx option is equivalent to -XX:MaxHeapSize. -Xnoclassgc Disables garbage collection (GC) of classes. This can save some GC time, which shortens interruptions during the application run. When you specify -Xnoclassgc at startup, the class objects in the application are left untouched during GC and are always be considered live. This can result in more memory being permanently occupied which, if not used carefully, throws an out-of-memory exception. -Xrs Reduces the use of operating system signals by the JVM. Shutdown hooks enable the orderly shutdown of a Java application by running user cleanup code (such as closing database connections) at shutdown, even if the JVM terminates abruptly. • Non-Windows: • The JVM catches signals to implement shutdown hooks for unexpected termination. The JVM uses SIGHUP, SIGINT, and SIGTERM to initiate the running of shutdown hooks. • Applications embedding the JVM frequently need to trap signals such as SIGINT or SIGTERM, which can lead to interference with the JVM signal handlers. The -Xrs option is available to address this issue. When -Xrs is used, the signal masks for SIGINT, SIGTERM, SIGHUP, and SIGQUIT aren't changed by the JVM, and signal handlers for these signals aren't installed. • Windows: • The JVM watches for console control events to implement shutdown hooks for unexpected termination. Specifically, the JVM registers a console control handler that begins shutdown-hook processing and returns TRUE for CTRL_C_EVENT, CTRL_CLOSE_EVENT, CTRL_LOGOFF_EVENT, and CTRL_SHUTDOWN_EVENT. • The JVM uses a similar mechanism to implement the feature of dumping thread stacks for debugging purposes. The JVM uses CTRL_BREAK_EVENT to perform thread dumps. • If the JVM is run as a service (for example, as a servlet engine for a web server), then it can receive CTRL_LOGOFF_EVENT but shouldn't initiate shutdown because the operating system doesn't actually terminate the process. To avoid possible interference such as this, the -Xrs option can be used. When the -Xrs option is used, the JVM doesn't install a console control handler, implying that it doesn't watch for or process CTRL_C_EVENT, CTRL_CLOSE_EVENT, CTRL_LOGOFF_EVENT, or CTRL_SHUTDOWN_EVENT. There are two consequences of specifying -Xrs: • Non-Windows: SIGQUIT thread dumps aren't available. • Windows: Ctrl + Break thread dumps aren't available. User code is responsible for causing shutdown hooks to run, for example, by calling System.exit() when the JVM is to be terminated. -Xshare:mode Sets the class data sharing (CDS) mode. Possible mode arguments for this option include the following: auto Use shared class data if possible (default). on Require using shared class data, otherwise fail. Note: The -Xshare:on option is used for testing purposes only. It may cause the VM to unexpectedly exit during start-up when the CDS archive cannot be used (for example, when certain VM parameters are changed, or when a different JDK is used). This option should not be used in production environments. off Do not attempt to use shared class data. -XshowSettings Shows all settings and then continues. -XshowSettings:category Shows settings and continues. Possible category arguments for this option include the following: all Shows all categories of settings. This is the default value. locale Shows settings related to locale. properties Shows settings related to system properties. vm Shows the settings of the JVM. system Linux only: Shows host system or container configuration and continues. -Xss size Sets the thread stack size (in bytes). Append the letter k or K to indicate KB, m or M to indicate MB, or g or G to indicate GB. The actual size may be rounded up to a multiple of the system page size as required by the operating system. The default value depends on the platform. For example: • Linux/x64: 1024 KB • Linux/Aarch64: 2048 KB • macOS/x64: 1024 KB • macOS/Aarch64: 2048 KB • Windows: The default value depends on virtual memory The following examples set the thread stack size to 1024 KB in different units: -Xss1m -Xss1024k -Xss1048576 This option is similar to -XX:ThreadStackSize. --add-reads module=target-module(,target-module)* Updates module to read the target-module, regardless of the module declaration. target-module can be ALL-UNNAMED to read all unnamed modules. --add-exports module/package=target-module(,target-module)* Updates module to export package to target-module, regardless of module declaration. target-module can be ALL-UNNAMED to export to all unnamed modules. --add-opens module/package=target-module(,target-module)* Updates module to open package to target-module, regardless of module declaration. --limit-modules module[,module...] Specifies the limit of the universe of observable modules. --patch-module module=file(;file)* Overrides or augments a module with classes and resources in JAR files or directories. --source version Sets the version of the source in source-file mode. EXTRA OPTIONS FOR MACOS The following extra options are macOS specific. -XstartOnFirstThread Runs the main() method on the first (AppKit) thread. -Xdock:name=application_name Overrides the default application name displayed in dock. -Xdock:icon=path_to_icon_file Overrides the default icon displayed in dock. ADVANCED OPTIONS FOR JAVA These java options can be used to enable other advanced options. -XX:+UnlockDiagnosticVMOptions Unlocks the options intended for diagnosing the JVM. By default, this option is disabled and diagnostic options aren't available. Command line options that are enabled with the use of this option are not supported. If you encounter issues while using any of these options, it is very likely that you will be required to reproduce the problem without using any of these unsupported options before Oracle Support can assist with an investigation. It is also possible that any of these options may be removed or their behavior changed without any warning. -XX:+UnlockExperimentalVMOptions Unlocks the options that provide experimental features in the JVM. By default, this option is disabled and experimental features aren't available. ADVANCED RUNTIME OPTIONS FOR JAVA These java options control the runtime behavior of the Java HotSpot VM. -XX:ActiveProcessorCount=x Overrides the number of CPUs that the VM will use to calculate the size of thread pools it will use for various operations such as Garbage Collection and ForkJoinPool. The VM normally determines the number of available processors from the operating system. This flag can be useful for partitioning CPU resources when running multiple Java processes in docker containers. This flag is honored even if UseContainerSupport is not enabled. See -XX:-UseContainerSupport for a description of enabling and disabling container support. -XX:AllocateHeapAt=path Takes a path to the file system and uses memory mapping to allocate the object heap on the memory device. Using this option enables the HotSpot VM to allocate the Java object heap on an alternative memory device, such as an NV-DIMM, specified by the user. Alternative memory devices that have the same semantics as DRAM, including the semantics of atomic operations, can be used instead of DRAM for the object heap without changing the existing application code. All other memory structures (such as the code heap, metaspace, and thread stacks) continue to reside in DRAM. Some operating systems expose non-DRAM memory through the file system. Memory-mapped files in these file systems bypass the page cache and provide a direct mapping of virtual memory to the physical memory on the device. The existing heap related flags (such as -Xmx and -Xms) and garbage-collection related flags continue to work as before. -XX:-CompactStrings Disables the Compact Strings feature. By default, this option is enabled. When this option is enabled, Java Strings containing only single-byte characters are internally represented and stored as single-byte-per-character Strings using ISO-8859-1 / Latin-1 encoding. This reduces, by 50%, the amount of space required for Strings containing only single-byte characters. For Java Strings containing at least one multibyte character: these are represented and stored as 2 bytes per character using UTF-16 encoding. Disabling the Compact Strings feature forces the use of UTF-16 encoding as the internal representation for all Java Strings. Cases where it may be beneficial to disable Compact Strings include the following: • When it's known that an application overwhelmingly will be allocating multibyte character Strings • In the unexpected event where a performance regression is observed in migrating from Java SE 8 to Java SE 9 and an analysis shows that Compact Strings introduces the regression In both of these scenarios, disabling Compact Strings makes sense. -XX:ErrorFile=filename Specifies the path and file name to which error data is written when an irrecoverable error occurs. By default, this file is created in the current working directory and named hs_err_pidpid.log where pid is the identifier of the process that encountered the error. The following example shows how to set the default log file (note that the identifier of the process is specified as %p): -XX:ErrorFile=./hs_err_pid%p.log • Non-Windows: The following example shows how to set the error log to /var/log/java/java_error.log: -XX:ErrorFile=/var/log/java/java_error.log • Windows: The following example shows how to set the error log file to C:/log/java/java_error.log: -XX:ErrorFile=C:/log/java/java_error.log If the file exists, and is writeable, then it will be overwritten. Otherwise, if the file can't be created in the specified directory (due to insufficient space, permission problem, or another issue), then the file is created in the temporary directory for the operating system: • Non-Windows: The temporary directory is /tmp. • Windows: The temporary directory is specified by the value of the TMP environment variable; if that environment variable isn't defined, then the value of the TEMP environment variable is used. -XX:+ExtensiveErrorReports Enables the reporting of more extensive error information in the ErrorFile. This option can be turned on in environments where maximal information is desired - even if the resulting logs may be quite large and/or contain information that might be considered sensitive. The information can vary from release to release, and across different platforms. By default this option is disabled. -XX:FlightRecorderOptions=parameter=value (or) -XX:FlightRecorderOptions:parameter=value Sets the parameters that control the behavior of JFR. Multiple parameters can be specified by separating them with a comma. The following list contains the available JFR parameter=value entries: globalbuffersize=size Specifies the total amount of primary memory used for data retention. The default value is based on the value specified for memorysize. Change the memorysize parameter to alter the size of global buffers. maxchunksize=size Specifies the maximum size (in bytes) of the data chunks in a recording. Append m or M to specify the size in megabytes (MB), or g or G to specify the size in gigabytes (GB). By default, the maximum size of data chunks is set to 12 MB. The minimum allowed is 1 MB. memorysize=size Determines how much buffer memory should be used, and sets the globalbuffersize and numglobalbuffers parameters based on the size specified. Append m or M to specify the size in megabytes (MB), or g or G to specify the size in gigabytes (GB). By default, the memory size is set to 10 MB. numglobalbuffers Specifies the number of global buffers used. The default value is based on the memory size specified. Change the memorysize parameter to alter the number of global buffers. old-object-queue-size=number-of-objects Maximum number of old objects to track. By default, the number of objects is set to 256. preserve-repository={true|false} Specifies whether files stored in the disk repository should be kept after the JVM has exited. If false, files are deleted. By default, this parameter is disabled. repository=path Specifies the repository (a directory) for temporary disk storage. By default, the system's temporary directory is used. retransform={true|false} Specifies whether event classes should be retransformed using JVMTI. If false, instrumentation is added when event classes are loaded. By default, this parameter is enabled. stackdepth=depth Stack depth for stack traces. By default, the depth is set to 64 method calls. The maximum is 2048. Values greater than 64 could create significant overhead and reduce performance. threadbuffersize=size Specifies the per-thread local buffer size (in bytes). By default, the local buffer size is set to 8 kilobytes, with a minimum value of 4 kilobytes. Overriding this parameter could reduce performance and is not recommended. -XX:LargePageSizeInBytes=size Sets the maximum large page size (in bytes) used by the JVM. The size argument must be a valid page size supported by the environment to have any effect. Append the letter k or K to indicate kilobytes, m or M to indicate megabytes, or g or G to indicate gigabytes. By default, the size is set to 0, meaning that the JVM will use the default large page size for the environment as the maximum size for large pages. See Large Pages. The following example describes how to set the large page size to 1 gigabyte (GB): -XX:LargePageSizeInBytes=1g -XX:MaxDirectMemorySize=size Sets the maximum total size (in bytes) of the java.nio package, direct-buffer allocations. Append the letter k or K to indicate kilobytes, m or M to indicate megabytes, or g or G to indicate gigabytes. If not set, the flag is ignored and the JVM chooses the size for NIO direct-buffer allocations automatically. The following examples illustrate how to set the NIO size to 1024 KB in different units: -XX:MaxDirectMemorySize=1m -XX:MaxDirectMemorySize=1024k -XX:MaxDirectMemorySize=1048576 -XX:-MaxFDLimit Disables the attempt to set the soft limit for the number of open file descriptors to the hard limit. By default, this option is enabled on all platforms, but is ignored on Windows. The only time that you may need to disable this is on macOS, where its use imposes a maximum of 10240, which is lower than the actual system maximum. -XX:NativeMemoryTracking=mode Specifies the mode for tracking JVM native memory usage. Possible mode arguments for this option include the following: off Instructs not to track JVM native memory usage. This is the default behavior if you don't specify the -XX:NativeMemoryTracking option. summary Tracks memory usage only by JVM subsystems, such as Java heap, class, code, and thread. detail In addition to tracking memory usage by JVM subsystems, track memory usage by individual CallSite, individual virtual memory region and its committed regions. -XX:TrimNativeHeapInterval=millis Interval, in ms, at which the JVM will trim the native heap. Lower values will reclaim memory more eagerly at the cost of higher overhead. A value of 0 (default) disables native heap trimming. Native heap trimming is performed in a dedicated thread. This option is only supported on Linux with GNU C Library (glibc). -XX:+NeverActAsServerClassMachine Enable the "Client VM emulation" mode which only uses the C1 JIT compiler, a 32Mb CodeCache and the Serial GC. The maximum amount of memory that the JVM may use (controlled by the -XX:MaxRAM=n flag) is set to 1GB by default. The string "emulated-client" is added to the JVM version string. By default the flag is set to true only on Windows in 32-bit mode and false in all other cases. The "Client VM emulation" mode will not be enabled if any of the following flags are used on the command line: -XX:{+|-}TieredCompilation -XX:CompilationMode=mode -XX:TieredStopAtLevel=n -XX:{+|-}EnableJVMCI -XX:{+|-}UseJVMCICompiler -XX:ObjectAlignmentInBytes=alignment Sets the memory alignment of Java objects (in bytes). By default, the value is set to 8 bytes. The specified value should be a power of 2, and must be within the range of 8 and 256 (inclusive). This option makes it possible to use compressed pointers with large Java heap sizes. The heap size limit in bytes is calculated as: 4GB * ObjectAlignmentInBytes Note: As the alignment value increases, the unused space between objects also increases. As a result, you may not realize any benefits from using compressed pointers with large Java heap sizes. -XX:OnError=string Sets a custom command or a series of semicolon-separated commands to run when an irrecoverable error occurs. If the string contains spaces, then it must be enclosed in quotation marks. • Non-Windows: The following example shows how the -XX:OnError option can be used to run the gcore command to create a core image, and start the gdb debugger to attach to the process in case of an irrecoverable error (the %p designates the current process identifier): -XX:OnError="gcore %p;gdb -p %p" • Windows: The following example shows how the -XX:OnError option can be used to run the userdump.exe utility to obtain a crash dump in case of an irrecoverable error (the %p designates the current process identifier). This example assumes that the path to the userdump.exe utility is specified in the PATH environment variable: -XX:OnError="userdump.exe %p" -XX:OnOutOfMemoryError=string Sets a custom command or a series of semicolon-separated commands to run when an OutOfMemoryError exception is first thrown. If the string contains spaces, then it must be enclosed in quotation marks. For an example of a command string, see the description of the -XX:OnError option. -XX:+PrintCommandLineFlags Enables printing of ergonomically selected JVM flags that appeared on the command line. It can be useful to know the ergonomic values set by the JVM, such as the heap space size and the selected garbage collector. By default, this option is disabled and flags aren't printed. -XX:+PreserveFramePointer Selects between using the RBP register as a general purpose register (-XX:-PreserveFramePointer) and using the RBP register to hold the frame pointer of the currently executing method (-XX:+PreserveFramePointer . If the frame pointer is available, then external profiling tools (for example, Linux perf) can construct more accurate stack traces. -XX:+PrintNMTStatistics Enables printing of collected native memory tracking data at JVM exit when native memory tracking is enabled (see -XX:NativeMemoryTracking). By default, this option is disabled and native memory tracking data isn't printed. -XX:SharedArchiveFile=path Specifies the path and name of the class data sharing (CDS) archive file See Application Class Data Sharing. -XX:+VerifySharedSpaces If this option is specified, the JVM will load a CDS archive file only if it passes an integrity check based on CRC32 checksums. The purpose of this flag is to check for unintentional damage to CDS archive files in transmission or storage. To guarantee the security and proper operation of CDS, the user must ensure that the CDS archive files used by Java applications cannot be modified without proper authorization. -XX:SharedArchiveConfigFile=shared_config_file Specifies additional shared data added to the archive file. -XX:SharedClassListFile=file_name Specifies the text file that contains the names of the classes to store in the class data sharing (CDS) archive. This file contains the full name of one class per line, except slashes (/) replace dots (.). For example, to specify the classes java.lang.Object and hello.Main, create a text file that contains the following two lines: java/lang/Object hello/Main The classes that you specify in this text file should include the classes that are commonly used by the application. They may include any classes from the application, extension, or bootstrap class paths. See Application Class Data Sharing. -XX:+ShowCodeDetailsInExceptionMessages Enables printing of improved NullPointerException messages. When an application throws a NullPointerException, the option enables the JVM to analyze the program's bytecode instructions to determine precisely which reference is null, and describes the source with a null-detail message. The null-detail message is calculated and returned by NullPointerException.getMessage(), and will be printed as the exception message along with the method, filename, and line number. By default, this option is enabled. -XX:+ShowMessageBoxOnError Enables the display of a dialog box when the JVM experiences an irrecoverable error. This prevents the JVM from exiting and keeps the process active so that you can attach a debugger to it to investigate the cause of the error. By default, this option is disabled. -XX:StartFlightRecording=parameter=value Starts a JFR recording for the Java application. This option is equivalent to the JFR.start diagnostic command that starts a recording during runtime. You can set the following parameter=value entries when starting a JFR recording: delay=time Specifies the delay between the Java application launch time and the start of the recording. Append s to specify the time in seconds, m for minutes, h for hours, or d for days (for example, specifying 10m means 10 minutes). By default, there's no delay, and this parameter is set to 0. disk={true|false} Specifies whether to write data to disk while recording. By default, this parameter is enabled. dumponexit={true|false} Specifies if the running recording is dumped when the JVM shuts down. If enabled and a filename is not entered, the recording is written to a file in the directory where the process was started. The file name is a system- generated name that contains the process ID, recording ID, and current timestamp, similar to hotspot-pid-47496-id-1-2018_01_25_19_10_41.jfr. By default, this parameter is disabled. duration=time Specifies the duration of the recording. Append s to specify the time in seconds, m for minutes, h for hours, or d for days (for example, specifying 5h means 5 hours). By default, the duration isn't limited, and this parameter is set to 0. filename=path Specifies the path and name of the file to which the recording is written when the recording is stopped, for example: • recording.jfr • /home/user/recordings/recording.jfr • c:\recordings\recording.jfr If %p and/or %t is specified in the filename, it expands to the JVM's PID and the current timestamp, respectively. name=identifier Takes both the name and the identifier of a recording. maxage=time Specifies the maximum age of disk data to keep for the recording. This parameter is valid only when the disk parameter is set to true. Append s to specify the time in seconds, m for minutes, h for hours, or d for days (for example, specifying 30s means 30 seconds). By default, the maximum age isn't limited, and this parameter is set to 0s. maxsize=size Specifies the maximum size (in bytes) of disk data to keep for the recording. This parameter is valid only when the disk parameter is set to true. The value must not be less than the value for the maxchunksize parameter set with -XX:FlightRecorderOptions. Append m or M to specify the size in megabytes, or g or G to specify the size in gigabytes. By default, the maximum size of disk data isn't limited, and this parameter is set to 0. path-to-gc-roots={true|false} Specifies whether to collect the path to garbage collection (GC) roots at the end of a recording. By default, this parameter is disabled. The path to GC roots is useful for finding memory leaks, but collecting it is time-consuming. Enable this option only when you start a recording for an application that you suspect has a memory leak. If the settings parameter is set to profile, the stack trace from where the potential leaking object was allocated is included in the information collected. settings=path Specifies the path and name of the event settings file (of type JFC). By default, the default.jfc file is used, which is located in JAVA_HOME/lib/jfr. This default settings file collects a predefined set of information with low overhead, so it has minimal impact on performance and can be used with recordings that run continuously. A second settings file is also provided, profile.jfc, which provides more data than the default configuration, but can have more overhead and impact performance. Use this configuration for short periods of time when more information is needed. You can specify values for multiple parameters by separating them with a comma. Event settings and .jfc options can be specified using the following syntax: option=value Specifies the option value to modify. To list available options, use the JAVA_HOME/bin/jfr tool. event-setting=value Specifies 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 '+'. You can specify values for multiple event settings and .jfc options by separating them with a comma. In case of a conflict between a parameter and a .jfc option, the parameter will take precedence. 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. -XX:ThreadStackSize=size Sets the Java thread stack size (in kilobytes). Use of a scaling suffix, such as k, results in the scaling of the kilobytes value so that -XX:ThreadStackSize=1k sets the Java thread stack size to 1024*1024 bytes or 1 megabyte. The default value depends on the platform. For example: • Linux/x64: 1024 KB • Linux/Aarch64: 2048 KB • macOS/x64: 1024 KB • macOS/Aarch64: 2048 KB • Windows: The default value depends on virtual memory The following examples show how to set the thread stack size to 1 megabyte in different units: -XX:ThreadStackSize=1k -XX:ThreadStackSize=1024 This option is similar to -Xss. -XX:-UseCompressedOops Disables the use of compressed pointers. By default, this option is enabled, and compressed pointers are used. This will automatically limit the maximum ergonomically determined Java heap size to the maximum amount of memory that can be covered by compressed pointers. By default this range is 32 GB. With compressed oops enabled, object references are represented as 32-bit offsets instead of 64-bit pointers, which typically increases performance when running the application with Java heap sizes smaller than the compressed oops pointer range. This option works only for 64-bit JVMs. It's possible to use compressed pointers with Java heap sizes greater than 32 GB. See the -XX:ObjectAlignmentInBytes option. -XX:-UseContainerSupport Linux only: The VM now provides automatic container detection support, which allows the VM to determine the amount of memory and number of processors that are available to a Java process running in docker containers. It uses this information to allocate system resources. The default for this flag is true, and container support is enabled by default. It can be disabled with -XX:-UseContainerSupport. Unified Logging is available to help to diagnose issues related to this support. Use -Xlog:os+container=trace for maximum logging of container information. See Enable Logging with the JVM Unified Logging Framework for a description of using Unified Logging. -XX:+UseLargePages Enables the use of large page memory. By default, this option is disabled and large page memory isn't used. See Large Pages. -XX:+UseTransparentHugePages Linux only: Enables the use of large pages that can dynamically grow or shrink. This option is disabled by default. You may encounter performance problems with transparent huge pages as the OS moves other pages around to create huge pages; this option is made available for experimentation. -XX:+AllowUserSignalHandlers Non-Windows: Enables installation of signal handlers by the application. By default, this option is disabled and the application isn't allowed to install signal handlers. -XX:VMOptionsFile=filename Allows user to specify VM options in a file, for example, java -XX:VMOptionsFile=/var/my_vm_options HelloWorld. -XX:UseBranchProtection=mode Linux AArch64 only: Specifies the branch protection mode. All options other than none require the VM to have been built with branch protection enabled. In addition, for full protection, any native libraries provided by applications should be compiled with the same level of protection. Possible mode arguments for this option include the following: none Do not use branch protection. This is the default value. standard Enables all branch protection modes available on the current platform. pac-ret Enables protection against ROP based attacks. (AArch64 8.3+ only) ADVANCED JIT COMPILER OPTIONS FOR JAVA These java options control the dynamic just-in-time (JIT) compilation performed by the Java HotSpot VM. -XX:AllocateInstancePrefetchLines=lines Sets the number of lines to prefetch ahead of the instance allocation pointer. By default, the number of lines to prefetch is set to 1: -XX:AllocateInstancePrefetchLines=1 -XX:AllocatePrefetchDistance=size Sets the size (in bytes) of the prefetch distance for object allocation. Memory about to be written with the value of new objects is prefetched up to this distance starting from the address of the last allocated object. Each Java thread has its own allocation point. Negative values denote that prefetch distance is chosen based on the platform. Positive values are bytes to prefetch. Append the letter k or K to indicate kilobytes, m or M to indicate megabytes, or g or G to indicate gigabytes. The default value is set to -1. The following example shows how to set the prefetch distance to 1024 bytes: -XX:AllocatePrefetchDistance=1024 -XX:AllocatePrefetchInstr=instruction Sets the prefetch instruction to prefetch ahead of the allocation pointer. Possible values are from 0 to 3. The actual instructions behind the values depend on the platform. By default, the prefetch instruction is set to 0: -XX:AllocatePrefetchInstr=0 -XX:AllocatePrefetchLines=lines Sets the number of cache lines to load after the last object allocation by using the prefetch instructions generated in compiled code. The default value is 1 if the last allocated object was an instance, and 3 if it was an array. The following example shows how to set the number of loaded cache lines to 5: -XX:AllocatePrefetchLines=5 -XX:AllocatePrefetchStepSize=size Sets the step size (in bytes) for sequential prefetch instructions. Append the letter k or K to indicate kilobytes, m or M to indicate megabytes, g or G to indicate gigabytes. By default, the step size is set to 16 bytes: -XX:AllocatePrefetchStepSize=16 -XX:AllocatePrefetchStyle=style Sets the generated code style for prefetch instructions. The style argument is an integer from 0 to 3: 0 Don't generate prefetch instructions. 1 Execute prefetch instructions after each allocation. This is the default setting. 2 Use the thread-local allocation block (TLAB) watermark pointer to determine when prefetch instructions are executed. 3 Generate one prefetch instruction per cache line. -XX:+BackgroundCompilation Enables background compilation. This option is enabled by default. To disable background compilation, specify -XX:-BackgroundCompilation (this is equivalent to specifying -Xbatch). -XX:CICompilerCount=threads Sets the number of compiler threads to use for compilation. By default, the number of compiler threads is selected automatically depending on the number of CPUs and memory available for compiled code. The following example shows how to set the number of threads to 2: -XX:CICompilerCount=2 -XX:+UseDynamicNumberOfCompilerThreads Dynamically create compiler thread up to the limit specified by -XX:CICompilerCount. This option is enabled by default. -XX:CompileCommand=command,method[,option] Specifies a command to perform on a method. For example, to exclude the indexOf() method of the String class from being compiled, use the following: -XX:CompileCommand=exclude,java/lang/String.indexOf Note that the full class name is specified, including all packages and subpackages separated by a slash (/). For easier cut-and-paste operations, it's also possible to use the method name format produced by the -XX:+PrintCompilation and -XX:+LogCompilation options: -XX:CompileCommand=exclude,java.lang.String::indexOf If the method is specified without the signature, then the command is applied to all methods with the specified name. However, you can also specify the signature of the method in the class file format. In this case, you should enclose the arguments in quotation marks, because otherwise the shell treats the semicolon as a command end. For example, if you want to exclude only the indexOf(String) method of the String class from being compiled, use the following: -XX:CompileCommand="exclude,java/lang/String.indexOf,(Ljava/lang/String;)I" You can also use the asterisk (*) as a wildcard for class and method names. For example, to exclude all indexOf() methods in all classes from being compiled, use the following: -XX:CompileCommand=exclude,*.indexOf The commas and periods are aliases for spaces, making it easier to pass compiler commands through a shell. You can pass arguments to -XX:CompileCommand using spaces as separators by enclosing the argument in quotation marks: -XX:CompileCommand="exclude java/lang/String indexOf" Note that after parsing the commands passed on the command line using the -XX:CompileCommand options, the JIT compiler then reads commands from the .hotspot_compiler file. You can add commands to this file or specify a different file using the -XX:CompileCommandFile option. To add several commands, either specify the -XX:CompileCommand option multiple times, or separate each argument with the new line separator (\n). The following commands are available: break Sets a breakpoint when debugging the JVM to stop at the beginning of compilation of the specified method. compileonly Excludes all methods from compilation except for the specified method. As an alternative, you can use the -XX:CompileOnly option, which lets you specify several methods. dontinline Prevents inlining of the specified method. exclude Excludes the specified method from compilation. help Prints a help message for the -XX:CompileCommand option. inline Attempts to inline the specified method. log Excludes compilation logging (with the -XX:+LogCompilation option) for all methods except for the specified method. By default, logging is performed for all compiled methods. option Passes a JIT compilation option to the specified method in place of the last argument (option). The compilation option is set at the end, after the method name. For example, to enable the BlockLayoutByFrequency option for the append() method of the StringBuffer class, use the following: -XX:CompileCommand=option,java/lang/StringBuffer.append,BlockLayoutByFrequency You can specify multiple compilation options, separated by commas or spaces. print Prints generated assembler code after compilation of the specified method. quiet Instructs not to print the compile commands. By default, the commands that you specify with the -XX:CompileCommand option are printed; for example, if you exclude from compilation the indexOf() method of the String class, then the following is printed to standard output: CompilerOracle: exclude java/lang/String.indexOf You can suppress this by specifying the -XX:CompileCommand=quiet option before other -XX:CompileCommand options. -XX:CompileCommandFile=filename Sets the file from which JIT compiler commands are read. By default, the .hotspot_compiler file is used to store commands performed by the JIT compiler. Each line in the command file represents a command, a class name, and a method name for which the command is used. For example, this line prints assembly code for the toString() method of the String class: print java/lang/String toString If you're using commands for the JIT compiler to perform on methods, then see the -XX:CompileCommand option. -XX:CompilerDirectivesFile=file Adds directives from a file to the directives stack when a program starts. See Compiler Control [https://docs.oracle.com/en/java/javase/12/vm/compiler- control1.html#GUID-94AD8194-786A-4F19-BFFF-278F8E237F3A]. The -XX:CompilerDirectivesFile option has to be used together with the -XX:UnlockDiagnosticVMOptions option that unlocks diagnostic JVM options. -XX:+CompilerDirectivesPrint Prints the directives stack when the program starts or when a new directive is added. The -XX:+CompilerDirectivesPrint option has to be used together with the -XX:UnlockDiagnosticVMOptions option that unlocks diagnostic JVM options. -XX:CompileOnly=methods Sets the list of methods (separated by commas) to which compilation should be restricted. Only the specified methods are compiled. -XX:CompileOnly=method1,method2,...,methodN is an alias for: -XX:CompileCommand=compileonly,method1 -XX:CompileCommand=compileonly,method2 ... -XX:CompileCommand=compileonly,methodN -XX:CompileThresholdScaling=scale Provides unified control of first compilation. This option controls when methods are first compiled for both the tiered and the nontiered modes of operation. The CompileThresholdScaling option has a floating point value between 0 and +Inf and scales the thresholds corresponding to the current mode of operation (both tiered and nontiered). Setting CompileThresholdScaling to a value less than 1.0 results in earlier compilation while values greater than 1.0 delay compilation. Setting CompileThresholdScaling to 0 is equivalent to disabling compilation. -XX:+DoEscapeAnalysis Enables the use of escape analysis. This option is enabled by default. To disable the use of escape analysis, specify -XX:-DoEscapeAnalysis. -XX:InitialCodeCacheSize=size Sets the initial code cache size (in bytes). Append the letter k or K to indicate kilobytes, m or M to indicate megabytes, or g or G to indicate gigabytes. The default value depends on the platform. The initial code cache size shouldn't be less than the system's minimal memory page size. The following example shows how to set the initial code cache size to 32 KB: -XX:InitialCodeCacheSize=32k -XX:+Inline Enables method inlining. This option is enabled by default to increase performance. To disable method inlining, specify -XX:-Inline. -XX:InlineSmallCode=size Sets the maximum code size (in bytes) for already compiled methods that may be inlined. This flag only applies to the C2 compiler. Append the letter k or K to indicate kilobytes, m or M to indicate megabytes, or g or G to indicate gigabytes. The default value depends on the platform and on whether tiered compilation is enabled. In the following example it is set to 1000 bytes: -XX:InlineSmallCode=1000 -XX:+LogCompilation Enables logging of compilation activity to a file named hotspot.log in the current working directory. You can specify a different log file path and name using the -XX:LogFile option. By default, this option is disabled and compilation activity isn't logged. The -XX:+LogCompilation option has to be used together with the -XX:UnlockDiagnosticVMOptions option that unlocks diagnostic JVM options. You can enable verbose diagnostic output with a message printed to the console every time a method is compiled by using the -XX:+PrintCompilation option. -XX:FreqInlineSize=size Sets the maximum bytecode size (in bytes) of a hot method to be inlined. This flag only applies to the C2 compiler. Append the letter k or K to indicate kilobytes, m or M to indicate megabytes, or g or G to indicate gigabytes. The default value depends on the platform. In the following example it is set to 325 bytes: -XX:FreqInlineSize=325 -XX:MaxInlineSize=size Sets the maximum bytecode size (in bytes) of a cold method to be inlined. This flag only applies to the C2 compiler. Append the letter k or K to indicate kilobytes, m or M to indicate megabytes, or g or G to indicate gigabytes. By default, the maximum bytecode size is set to 35 bytes: -XX:MaxInlineSize=35 -XX:C1MaxInlineSize=size Sets the maximum bytecode size (in bytes) of a cold method to be inlined. This flag only applies to the C1 compiler. Append the letter k or K to indicate kilobytes, m or M to indicate megabytes, or g or G to indicate gigabytes. By default, the maximum bytecode size is set to 35 bytes: -XX:MaxInlineSize=35 -XX:MaxTrivialSize=size Sets the maximum bytecode size (in bytes) of a trivial method to be inlined. This flag only applies to the C2 compiler. Append the letter k or K to indicate kilobytes, m or M to indicate megabytes, or g or G to indicate gigabytes. By default, the maximum bytecode size of a trivial method is set to 6 bytes: -XX:MaxTrivialSize=6 -XX:C1MaxTrivialSize=size Sets the maximum bytecode size (in bytes) of a trivial method to be inlined. This flag only applies to the C1 compiler. Append the letter k or K to indicate kilobytes, m or M to indicate megabytes, or g or G to indicate gigabytes. By default, the maximum bytecode size of a trivial method is set to 6 bytes: -XX:MaxTrivialSize=6 -XX:MaxNodeLimit=nodes Sets the maximum number of nodes to be used during single method compilation. By default the value depends on the features enabled. In the following example the maximum number of nodes is set to 100,000: -XX:MaxNodeLimit=100000 -XX:NonNMethodCodeHeapSize=size Sets the size in bytes of the code segment containing nonmethod code. A nonmethod code segment containing nonmethod code, such as compiler buffers and the bytecode interpreter. This code type stays in the code cache forever. This flag is used only if -XX:SegmentedCodeCache is enabled. -XX:NonProfiledCodeHeapSize=size Sets the size in bytes of the code segment containing nonprofiled methods. This flag is used only if -XX:SegmentedCodeCache is enabled. -XX:+OptimizeStringConcat Enables the optimization of String concatenation operations. This option is enabled by default. To disable the optimization of String concatenation operations, specify -XX:-OptimizeStringConcat. -XX:+PrintAssembly Enables printing of assembly code for bytecoded and native methods by using the external hsdis-<arch>.so or .dll library. For 64-bit VM on Windows, it's hsdis-amd64.dll. This lets you to see the generated code, which may help you to diagnose performance issues. By default, this option is disabled and assembly code isn't printed. The -XX:+PrintAssembly option has to be used together with the -XX:UnlockDiagnosticVMOptions option that unlocks diagnostic JVM options. -XX:ProfiledCodeHeapSize=size Sets the size in bytes of the code segment containing profiled methods. This flag is used only if -XX:SegmentedCodeCache is enabled. -XX:+PrintCompilation Enables verbose diagnostic output from the JVM by printing a message to the console every time a method is compiled. This lets you to see which methods actually get compiled. By default, this option is disabled and diagnostic output isn't printed. You can also log compilation activity to a file by using the -XX:+LogCompilation option. -XX:+PrintInlining Enables printing of inlining decisions. This let's you see which methods are getting inlined. By default, this option is disabled and inlining information isn't printed. The -XX:+PrintInlining option has to be used together with the -XX:+UnlockDiagnosticVMOptions option that unlocks diagnostic JVM options. -XX:ReservedCodeCacheSize=size Sets the maximum code cache size (in bytes) for JIT-compiled code. Append the letter k or K to indicate kilobytes, m or M to indicate megabytes, or g or G to indicate gigabytes. The default maximum code cache size is 240 MB; if you disable tiered compilation with the option -XX:-TieredCompilation, then the default size is 48 MB. This option has a limit of 2 GB; otherwise, an error is generated. The maximum code cache size shouldn't be less than the initial code cache size; see the option -XX:InitialCodeCacheSize. -XX:RTMAbortRatio=abort_ratio Specifies the RTM abort ratio is specified as a percentage (%) of all executed RTM transactions. If a number of aborted transactions becomes greater than this ratio, then the compiled code is deoptimized. This ratio is used when the -XX:+UseRTMDeopt option is enabled. The default value of this option is 50. This means that the compiled code is deoptimized if 50% of all transactions are aborted. -XX:RTMRetryCount=number_of_retries Specifies the number of times that the RTM locking code is retried, when it is aborted or busy, before falling back to the normal locking mechanism. The default value for this option is 5. The -XX:UseRTMLocking option must be enabled. -XX:+SegmentedCodeCache Enables segmentation of the code cache, without which the code cache consists of one large segment. With -XX:+SegmentedCodeCache, separate segments will be used for non- method, profiled method, and non-profiled method code. The segments are not resized at runtime. The advantages are better control of the memory footprint, reduced code fragmentation, and better CPU iTLB (instruction translation lookaside buffer) and instruction cache behavior due to improved locality. The feature is enabled by default if tiered compilation is enabled (-XX:+TieredCompilation ) and the reserved code cache size (-XX:ReservedCodeCacheSize) is at least 240 MB. -XX:StartAggressiveSweepingAt=percent Forces stack scanning of active methods to aggressively remove unused code when only the given percentage of the code cache is free. The default value is 10%. -XX:-TieredCompilation Disables the use of tiered compilation. By default, this option is enabled. -XX:UseSSE=version Enables the use of SSE instruction set of a specified version. Is set by default to the highest supported version available (x86 only). -XX:UseAVX=version Enables the use of AVX instruction set of a specified version. Is set by default to the highest supported version available (x86 only). -XX:+UseAES Enables hardware-based AES intrinsics for hardware that supports it. This option is on by default on hardware that has the necessary instructions. The -XX:+UseAES is used in conjunction with UseAESIntrinsics. Flags that control intrinsics now require the option -XX:+UnlockDiagnosticVMOptions. -XX:+UseAESIntrinsics Enables AES intrinsics. Specifying -XX:+UseAESIntrinsics is equivalent to also enabling -XX:+UseAES. To disable hardware- based AES intrinsics, specify -XX:-UseAES -XX:-UseAESIntrinsics. For example, to enable hardware AES, use the following flags: -XX:+UseAES -XX:+UseAESIntrinsics Flags that control intrinsics now require the option -XX:+UnlockDiagnosticVMOptions. -XX:+UseAESCTRIntrinsics Analogous to -XX:+UseAESIntrinsics enables AES/CTR intrinsics. -XX:+UseGHASHIntrinsics Controls the use of GHASH intrinsics. Enabled by default on platforms that support the corresponding instructions. Flags that control intrinsics now require the option -XX:+UnlockDiagnosticVMOptions. -XX:+UseChaCha20Intrinsics Enable ChaCha20 intrinsics. This option is on by default for supported platforms. To disable ChaCha20 intrinsics, specify -XX:-UseChaCha20Intrinsics. Flags that control intrinsics now require the option -XX:+UnlockDiagnosticVMOptions. -XX:+UsePoly1305Intrinsics Enable Poly1305 intrinsics. This option is on by default for supported platforms. To disable Poly1305 intrinsics, specify -XX:-UsePoly1305Intrinsics. Flags that control intrinsics now require the option -XX:+UnlockDiagnosticVMOptions. -XX:+UseBASE64Intrinsics Controls the use of accelerated BASE64 encoding routines for java.util.Base64. Enabled by default on platforms that support it. Flags that control intrinsics now require the option -XX:+UnlockDiagnosticVMOptions. -XX:+UseAdler32Intrinsics Controls the use of Adler32 checksum algorithm intrinsic for java.util.zip.Adler32. Enabled by default on platforms that support it. Flags that control intrinsics now require the option -XX:+UnlockDiagnosticVMOptions. -XX:+UseCRC32Intrinsics Controls the use of CRC32 intrinsics for java.util.zip.CRC32. Enabled by default on platforms that support it. Flags that control intrinsics now require the option -XX:+UnlockDiagnosticVMOptions. -XX:+UseCRC32CIntrinsics Controls the use of CRC32C intrinsics for java.util.zip.CRC32C. Enabled by default on platforms that support it. Flags that control intrinsics now require the option -XX:+UnlockDiagnosticVMOptions. -XX:+UseSHA Enables hardware-based intrinsics for SHA crypto hash functions for some hardware. The UseSHA option is used in conjunction with the UseSHA1Intrinsics, UseSHA256Intrinsics, and UseSHA512Intrinsics options. The UseSHA and UseSHA*Intrinsics flags are enabled by default on machines that support the corresponding instructions. This feature is applicable only when using the sun.security.provider.Sun provider for SHA operations. Flags that control intrinsics now require the option -XX:+UnlockDiagnosticVMOptions. To disable all hardware-based SHA intrinsics, specify the -XX:-UseSHA. To disable only a particular SHA intrinsic, use the appropriate corresponding option. For example: -XX:-UseSHA256Intrinsics. -XX:+UseSHA1Intrinsics Enables intrinsics for SHA-1 crypto hash function. Flags that control intrinsics now require the option -XX:+UnlockDiagnosticVMOptions. -XX:+UseSHA256Intrinsics Enables intrinsics for SHA-224 and SHA-256 crypto hash functions. Flags that control intrinsics now require the option -XX:+UnlockDiagnosticVMOptions. -XX:+UseSHA512Intrinsics Enables intrinsics for SHA-384 and SHA-512 crypto hash functions. Flags that control intrinsics now require the option -XX:+UnlockDiagnosticVMOptions. -XX:+UseMathExactIntrinsics Enables intrinsification of various java.lang.Math.*Exact() functions. Enabled by default. Flags that control intrinsics now require the option -XX:+UnlockDiagnosticVMOptions. -XX:+UseMultiplyToLenIntrinsic Enables intrinsification of BigInteger.multiplyToLen(). Enabled by default on platforms that support it. Flags that control intrinsics now require the option -XX:+UnlockDiagnosticVMOptions. -XX:+UseSquareToLenIntrinsic Enables intrinsification of BigInteger.squareToLen(). Enabled by default on platforms that support it. Flags that control intrinsics now require the option -XX:+UnlockDiagnosticVMOptions. -XX:+UseMulAddIntrinsic Enables intrinsification of BigInteger.mulAdd(). Enabled by default on platforms that support it. Flags that control intrinsics now require the option -XX:+UnlockDiagnosticVMOptions. -XX:+UseMontgomeryMultiplyIntrinsic Enables intrinsification of BigInteger.montgomeryMultiply(). Enabled by default on platforms that support it. Flags that control intrinsics now require the option -XX:+UnlockDiagnosticVMOptions. -XX:+UseMontgomerySquareIntrinsic Enables intrinsification of BigInteger.montgomerySquare(). Enabled by default on platforms that support it. Flags that control intrinsics now require the option -XX:+UnlockDiagnosticVMOptions. -XX:+UseCMoveUnconditionally Generates CMove (scalar and vector) instructions regardless of profitability analysis. -XX:+UseCodeCacheFlushing Enables flushing of the code cache before shutting down the compiler. This option is enabled by default. To disable flushing of the code cache before shutting down the compiler, specify -XX:-UseCodeCacheFlushing. -XX:+UseCondCardMark Enables checking if the card is already marked before updating the card table. This option is disabled by default. It should be used only on machines with multiple sockets, where it increases the performance of Java applications that rely on concurrent operations. -XX:+UseCountedLoopSafepoints Keeps safepoints in counted loops. Its default value depends on whether the selected garbage collector requires low latency safepoints. -XX:LoopStripMiningIter=number_of_iterations Controls the number of iterations in the inner strip mined loop. Strip mining transforms counted loops into two level nested loops. Safepoints are kept in the outer loop while the inner loop can execute at full speed. This option controls the maximum number of iterations in the inner loop. The default value is 1,000. -XX:LoopStripMiningIterShortLoop=number_of_iterations Controls loop strip mining optimization. Loops with the number of iterations less than specified will not have safepoints in them. Default value is 1/10th of -XX:LoopStripMiningIter. -XX:+UseFMA Enables hardware-based FMA intrinsics for hardware where FMA instructions are available (such as, Intel and ARM64). FMA intrinsics are generated for the java.lang.Math.fma(a, b, c) methods that calculate the value of ( a * b + c ) expressions. -XX:+UseRTMDeopt Autotunes RTM locking depending on the abort ratio. This ratio is specified by the -XX:RTMAbortRatio option. If the number of aborted transactions exceeds the abort ratio, then the method containing the lock is deoptimized and recompiled with all locks as normal locks. This option is disabled by default. The -XX:+UseRTMLocking option must be enabled. -XX:+UseRTMLocking Generates Restricted Transactional Memory (RTM) locking code for all inflated locks, with the normal locking mechanism as the fallback handler. This option is disabled by default. Options related to RTM are available only on x86 CPUs that support Transactional Synchronization Extensions (TSX). RTM is part of Intel's TSX, which is an x86 instruction set extension and facilitates the creation of multithreaded applications. RTM introduces the new instructions XBEGIN, XABORT, XEND, and XTEST. The XBEGIN and XEND instructions enclose a set of instructions to run as a transaction. If no conflict is found when running the transaction, then the memory and register modifications are committed together at the XEND instruction. The XABORT instruction can be used to explicitly abort a transaction and the XTEST instruction checks if a set of instructions is being run in a transaction. A lock on a transaction is inflated when another thread tries to access the same transaction, thereby blocking the thread that didn't originally request access to the transaction. RTM requires that a fallback set of operations be specified in case a transaction aborts or fails. An RTM lock is a lock that has been delegated to the TSX's system. RTM improves performance for highly contended locks with low conflict in a critical region (which is code that must not be accessed by more than one thread concurrently). RTM also improves the performance of coarse-grain locking, which typically doesn't perform well in multithreaded applications. (Coarse-grain locking is the strategy of holding locks for long periods to minimize the overhead of taking and releasing locks, while fine-grained locking is the strategy of trying to achieve maximum parallelism by locking only when necessary and unlocking as soon as possible.) Also, for lightly contended locks that are used by different threads, RTM can reduce false cache line sharing, also known as cache line ping-pong. This occurs when multiple threads from different processors are accessing different resources, but the resources share the same cache line. As a result, the processors repeatedly invalidate the cache lines of other processors, which forces them to read from main memory instead of their cache. -XX:+UseSuperWord Enables the transformation of scalar operations into superword operations. Superword is a vectorization optimization. This option is enabled by default. To disable the transformation of scalar operations into superword operations, specify -XX:-UseSuperWord. ADVANCED SERVICEABILITY OPTIONS FOR JAVA These java options provide the ability to gather system information and perform extensive debugging. -XX:+DisableAttachMechanism Disables the mechanism that lets tools attach to the JVM. By default, this option is disabled, meaning that the attach mechanism is enabled and you can use diagnostics and troubleshooting tools such as jcmd, jstack, jmap, and jinfo. Note: The tools such as jcmd, jinfo, jmap, and jstack shipped with the JDK aren't supported when using the tools from one JDK version to troubleshoot a different JDK version. -XX:+DTraceAllocProbes Linux and macOS: Enable dtrace tool probes for object allocation. -XX:+DTraceMethodProbes Linux and macOS: Enable dtrace tool probes for method-entry and method-exit. -XX:+DTraceMonitorProbes Linux and macOS: Enable dtrace tool probes for monitor events. -XX:+HeapDumpOnOutOfMemoryError Enables the dumping of the Java heap to a file in the current directory by using the heap profiler (HPROF) when a java.lang.OutOfMemoryError exception is thrown. You can explicitly set the heap dump file path and name using the -XX:HeapDumpPath option. By default, this option is disabled and the heap isn't dumped when an OutOfMemoryError exception is thrown. -XX:HeapDumpPath=path Sets the path and file name for writing the heap dump provided by the heap profiler (HPROF) when the -XX:+HeapDumpOnOutOfMemoryError option is set. By default, the file is created in the current working directory, and it's named java_pid<pid>.hprof where <pid> is the identifier of the process that caused the error. The following example shows how to set the default file explicitly (%p represents the current process identifier): -XX:HeapDumpPath=./java_pid%p.hprof • Non-Windows: The following example shows how to set the heap dump file to /var/log/java/java_heapdump.hprof: -XX:HeapDumpPath=/var/log/java/java_heapdump.hprof • Windows: The following example shows how to set the heap dump file to C:/log/java/java_heapdump.log: -XX:HeapDumpPath=C:/log/java/java_heapdump.log -XX:LogFile=path Sets the path and file name to where log data is written. By default, the file is created in the current working directory, and it's named hotspot.log. • Non-Windows: The following example shows how to set the log file to /var/log/java/hotspot.log: -XX:LogFile=/var/log/java/hotspot.log • Windows: The following example shows how to set the log file to C:/log/java/hotspot.log: -XX:LogFile=C:/log/java/hotspot.log -XX:+PrintClassHistogram Enables printing of a class instance histogram after one of the following events: • Non-Windows: Control+\ (SIGQUIT) • Windows: Control+C (SIGTERM) By default, this option is disabled. Setting this option is equivalent to running the jmap -histo command, or the jcmd pid GC.class_histogram command, where pid is the current Java process identifier. -XX:+PrintConcurrentLocks Enables printing of java.util.concurrent locks after one of the following events: • Non-Windows: Control+\ (SIGQUIT) • Windows: Control+C (SIGTERM) By default, this option is disabled. Setting this option is equivalent to running the jstack -l command or the jcmd pid Thread.print -l command, where pid is the current Java process identifier. -XX:+PrintFlagsRanges Prints the range specified and allows automatic testing of the values. See Validate Java Virtual Machine Flag Arguments. -XX:+PerfDataSaveToFile If enabled, saves jstat binary data when the Java application exits. This binary data is saved in a file named hsperfdata_pid, where pid is the process identifier of the Java application that you ran. Use the jstat command to display the performance data contained in this file as follows: jstat -class file:///path/hsperfdata_pid jstat -gc file:///path/hsperfdata_pid -XX:+UsePerfData Enables the perfdata feature. This option is enabled by default to allow JVM monitoring and performance testing. Disabling it suppresses the creation of the hsperfdata_userid directories. To disable the perfdata feature, specify -XX:-UsePerfData. ADVANCED GARBAGE COLLECTION OPTIONS FOR JAVA These java options control how garbage collection (GC) is performed by the Java HotSpot VM. -XX:+AggressiveHeap Enables Java heap optimization. This sets various parameters to be optimal for long-running jobs with intensive memory allocation, based on the configuration of the computer (RAM and CPU). By default, the option is disabled and the heap sizes are configured less aggressively. -XX:+AlwaysPreTouch Requests the VM to touch every page on the Java heap after requesting it from the operating system and before handing memory out to the application. By default, this option is disabled and all pages are committed as the application uses the heap space. -XX:ConcGCThreads=threads Sets the number of threads used for concurrent GC. Sets threads to approximately 1/4 of the number of parallel garbage collection threads. The default value depends on the number of CPUs available to the JVM. For example, to set the number of threads for concurrent GC to 2, specify the following option: -XX:ConcGCThreads=2 -XX:+DisableExplicitGC Enables the option that disables processing of calls to the System.gc() method. This option is disabled by default, meaning that calls to System.gc() are processed. If processing of calls to System.gc() is disabled, then the JVM still performs GC when necessary. -XX:+ExplicitGCInvokesConcurrent Enables invoking of concurrent GC by using the System.gc() request. This option is disabled by default and can be enabled only with the -XX:+UseG1GC option. -XX:G1AdaptiveIHOPNumInitialSamples=number When -XX:UseAdaptiveIHOP is enabled, this option sets the number of completed marking cycles used to gather samples until G1 adaptively determines the optimum value of -XX:InitiatingHeapOccupancyPercent. Before, G1 uses the value of -XX:InitiatingHeapOccupancyPercent directly for this purpose. The default value is 3. -XX:G1HeapRegionSize=size Sets the size of the regions into which the Java heap is subdivided when using the garbage-first (G1) collector. The value is a power of 2 and can range from 1 MB to 32 MB. The default region size is determined ergonomically based on the heap size with a goal of approximately 2048 regions. The following example sets the size of the subdivisions to 16 MB: -XX:G1HeapRegionSize=16m -XX:G1HeapWastePercent=percent Sets the percentage of heap that you're willing to waste. The Java HotSpot VM doesn't initiate the mixed garbage collection cycle when the reclaimable percentage is less than the heap waste percentage. The default is 5 percent. -XX:G1MaxNewSizePercent=percent Sets the percentage of the heap size to use as the maximum for the young generation size. The default value is 60 percent of your Java heap. This is an experimental flag. This setting replaces the -XX:DefaultMaxNewGenPercent setting. -XX:G1MixedGCCountTarget=number Sets the target number of mixed garbage collections after a marking cycle to collect old regions with at most G1MixedGCLIveThresholdPercent live data. The default is 8 mixed garbage collections. The goal for mixed collections is to be within this target number. -XX:G1MixedGCLiveThresholdPercent=percent Sets the occupancy threshold for an old region to be included in a mixed garbage collection cycle. The default occupancy is 85 percent. This is an experimental flag. This setting replaces the -XX:G1OldCSetRegionLiveThresholdPercent setting. -XX:G1NewSizePercent=percent Sets the percentage of the heap to use as the minimum for the young generation size. The default value is 5 percent of your Java heap. This is an experimental flag. This setting replaces the -XX:DefaultMinNewGenPercent setting. -XX:G1OldCSetRegionThresholdPercent=percent Sets an upper limit on the number of old regions to be collected during a mixed garbage collection cycle. The default is 10 percent of the Java heap. -XX:G1ReservePercent=percent Sets the percentage of the heap (0 to 50) that's reserved as a false ceiling to reduce the possibility of promotion failure for the G1 collector. When you increase or decrease the percentage, ensure that you adjust the total Java heap by the same amount. By default, this option is set to 10%. The following example sets the reserved heap to 20%: -XX:G1ReservePercent=20 -XX:+G1UseAdaptiveIHOP Controls adaptive calculation of the old generation occupancy to start background work preparing for an old generation collection. If enabled, G1 uses -XX:InitiatingHeapOccupancyPercent for the first few times as specified by the value of -XX:G1AdaptiveIHOPNumInitialSamples, and after that adaptively calculates a new optimum value for the initiating occupancy automatically. Otherwise, the old generation collection process always starts at the old generation occupancy determined by -XX:InitiatingHeapOccupancyPercent. The default is enabled. -XX:InitialHeapSize=size Sets the initial size (in bytes) of the memory allocation pool. This value must be either 0, or a multiple of 1024 and greater than 1 MB. Append the letter k or K to indicate kilobytes, m or M to indicate megabytes, or g or G to indicate gigabytes. The default value is selected at run time based on the system configuration. The following examples show how to set the size of allocated memory to 6 MB using various units: -XX:InitialHeapSize=6291456 -XX:InitialHeapSize=6144k -XX:InitialHeapSize=6m If you set this option to 0, then the initial size is set as the sum of the sizes allocated for the old generation and the young generation. The size of the heap for the young generation can be set using the -XX:NewSize option. Note that the -Xms option sets both the minimum and the initial heap size of the heap. If -Xms appears after -XX:InitialHeapSize on the command line, then the initial heap size gets set to the value specified with -Xms. -XX:InitialRAMPercentage=percent Sets the initial amount of memory that the JVM will use for the Java heap before applying ergonomics heuristics as a percentage of the maximum amount determined as described in the -XX:MaxRAM option. The default value is 1.5625 percent. The following example shows how to set the percentage of the initial amount of memory used for the Java heap: -XX:InitialRAMPercentage=5 -XX:InitialSurvivorRatio=ratio Sets the initial survivor space ratio used by the throughput garbage collector (which is enabled by the -XX:+UseParallelGC option). Adaptive sizing is enabled by default with the throughput garbage collector by using the -XX:+UseParallelGC option, and the survivor space is resized according to the application behavior, starting with the initial value. If adaptive sizing is disabled (using the -XX:-UseAdaptiveSizePolicy option), then the -XX:SurvivorRatio option should be used to set the size of the survivor space for the entire execution of the application. The following formula can be used to calculate the initial size of survivor space (S) based on the size of the young generation (Y), and the initial survivor space ratio (R): S=Y/(R+2) The 2 in the equation denotes two survivor spaces. The larger the value specified as the initial survivor space ratio, the smaller the initial survivor space size. By default, the initial survivor space ratio is set to 8. If the default value for the young generation space size is used (2 MB), then the initial size of the survivor space is 0.2 MB. The following example shows how to set the initial survivor space ratio to 4: -XX:InitialSurvivorRatio=4 -XX:InitiatingHeapOccupancyPercent=percent Sets the percentage of the old generation occupancy (0 to 100) at which to start the first few concurrent marking cycles for the G1 garbage collector. By default, the initiating value is set to 45%. A value of 0 implies nonstop concurrent GC cycles from the beginning until G1 adaptively sets this value. See also the -XX:G1UseAdaptiveIHOP and -XX:G1AdaptiveIHOPNumInitialSamples options. The following example shows how to set the initiating heap occupancy to 75%: -XX:InitiatingHeapOccupancyPercent=75 -XX:MaxGCPauseMillis=time Sets a target for the maximum GC pause time (in milliseconds). This is a soft goal, and the JVM will make its best effort to achieve it. The specified value doesn't adapt to your heap size. By default, for G1 the maximum pause time target is 200 milliseconds. The other generational collectors do not use a pause time goal by default. The following example shows how to set the maximum target pause time to 500 ms: -XX:MaxGCPauseMillis=500 -XX:MaxHeapSize=size Sets the maximum size (in byes) of the memory allocation pool. This value must be a multiple of 1024 and greater than 2 MB. Append the letter k or K to indicate kilobytes, m or M to indicate megabytes, or g or G to indicate gigabytes. The default value is selected at run time based on the system configuration. For server deployments, the options -XX:InitialHeapSize and -XX:MaxHeapSize are often set to the same value. The following examples show how to set the maximum allowed size of allocated memory to 80 MB using various units: -XX:MaxHeapSize=83886080 -XX:MaxHeapSize=81920k -XX:MaxHeapSize=80m The -XX:MaxHeapSize option is equivalent to -Xmx. -XX:MaxHeapFreeRatio=percent Sets the maximum allowed percentage of free heap space (0 to 100) after a GC event. If free heap space expands above this value, then the heap is shrunk. By default, this value is set to 70%. Minimize the Java heap size by lowering the values of the parameters MaxHeapFreeRatio (default value is 70%) and MinHeapFreeRatio (default value is 40%) with the command-line options -XX:MaxHeapFreeRatio and -XX:MinHeapFreeRatio. Lowering MaxHeapFreeRatio to as low as 10% and MinHeapFreeRatio to 5% has successfully reduced the heap size without too much performance regression; however, results may vary greatly depending on your application. Try different values for these parameters until they're as low as possible yet still retain acceptable performance. -XX:MaxHeapFreeRatio=10 -XX:MinHeapFreeRatio=5 Customers trying to keep the heap small should also add the option -XX:-ShrinkHeapInSteps. See Performance Tuning Examples for a description of using this option to keep the Java heap small by reducing the dynamic footprint for embedded applications. -XX:MaxMetaspaceSize=size Sets the maximum amount of native memory that can be allocated for class metadata. By default, the size isn't limited. The amount of metadata for an application depends on the application itself, other running applications, and the amount of memory available on the system. The following example shows how to set the maximum class metadata size to 256 MB: -XX:MaxMetaspaceSize=256m -XX:MaxNewSize=size Sets the maximum size (in bytes) of the heap for the young generation (nursery). The default value is set ergonomically. -XX:MaxRAM=size Sets the maximum amount of memory that the JVM may use for the Java heap before applying ergonomics heuristics. The default value is the maximum amount of available memory to the JVM process or 128 GB, whichever is lower. The maximum amount of available memory to the JVM process is the minimum of the machine's physical memory and any constraints set by the environment (e.g. container). Specifying this option disables automatic use of compressed oops if the combined result of this and other options influencing the maximum amount of memory is larger than the range of memory addressable by compressed oops. See -XX:UseCompressedOops for further information about compressed oops. The following example shows how to set the maximum amount of available memory for sizing the Java heap to 2 GB: -XX:MaxRAM=2G -XX:MaxRAMPercentage=percent Sets the maximum amount of memory that the JVM may use for the Java heap before applying ergonomics heuristics as a percentage of the maximum amount determined as described in the -XX:MaxRAM option. The default value is 25 percent. Specifying this option disables automatic use of compressed oops if the combined result of this and other options influencing the maximum amount of memory is larger than the range of memory addressable by compressed oops. See -XX:UseCompressedOops for further information about compressed oops. The following example shows how to set the percentage of the maximum amount of memory used for the Java heap: -XX:MaxRAMPercentage=75 -XX:MinRAMPercentage=percent Sets the maximum amount of memory that the JVM may use for the Java heap before applying ergonomics heuristics as a percentage of the maximum amount determined as described in the -XX:MaxRAM option for small heaps. A small heap is a heap of approximately 125 MB. The default value is 50 percent. The following example shows how to set the percentage of the maximum amount of memory used for the Java heap for small heaps: -XX:MinRAMPercentage=75 -XX:MaxTenuringThreshold=threshold Sets the maximum tenuring threshold for use in adaptive GC sizing. The largest value is 15. The default value is 15 for the parallel (throughput) collector. The following example shows how to set the maximum tenuring threshold to 10: -XX:MaxTenuringThreshold=10 -XX:MetaspaceSize=size Sets the size of the allocated class metadata space that triggers a garbage collection the first time it's exceeded. This threshold for a garbage collection is increased or decreased depending on the amount of metadata used. The default size depends on the platform. -XX:MinHeapFreeRatio=percent Sets the minimum allowed percentage of free heap space (0 to 100) after a GC event. If free heap space falls below this value, then the heap is expanded. By default, this value is set to 40%. Minimize Java heap size by lowering the values of the parameters MaxHeapFreeRatio (default value is 70%) and MinHeapFreeRatio (default value is 40%) with the command-line options -XX:MaxHeapFreeRatio and -XX:MinHeapFreeRatio. Lowering MaxHeapFreeRatio to as low as 10% and MinHeapFreeRatio to 5% has successfully reduced the heap size without too much performance regression; however, results may vary greatly depending on your application. Try different values for these parameters until they're as low as possible, yet still retain acceptable performance. -XX:MaxHeapFreeRatio=10 -XX:MinHeapFreeRatio=5 Customers trying to keep the heap small should also add the option -XX:-ShrinkHeapInSteps. See Performance Tuning Examples for a description of using this option to keep the Java heap small by reducing the dynamic footprint for embedded applications. -XX:MinHeapSize=size Sets the minimum size (in bytes) of the memory allocation pool. This value must be either 0, or a multiple of 1024 and greater than 1 MB. Append the letter k or K to indicate kilobytes, m or M to indicate megabytes, or g or G to indicate gigabytes. The default value is selected at run time based on the system configuration. The following examples show how to set the minimum size of allocated memory to 6 MB using various units: -XX:MinHeapSize=6291456 -XX:MinHeapSize=6144k -XX:MinHeapSize=6m If you set this option to 0, then the minimum size is set to the same value as the initial size. -XX:NewRatio=ratio Sets the ratio between young and old generation sizes. By default, this option is set to 2. The following example shows how to set the young-to-old ratio to 1: -XX:NewRatio=1 -XX:NewSize=size Sets the initial size (in bytes) of the heap for the young generation (nursery). Append the letter k or K to indicate kilobytes, m or M to indicate megabytes, or g or G to indicate gigabytes. The young generation region of the heap is used for new objects. GC is performed in this region more often than in other regions. If the size for the young generation is too low, then a large number of minor GCs are performed. If the size is too high, then only full GCs are performed, which can take a long time to complete. It is recommended that you keep the size for the young generation greater than 25% and less than 50% of the overall heap size. The following examples show how to set the initial size of the young generation to 256 MB using various units: -XX:NewSize=256m -XX:NewSize=262144k -XX:NewSize=268435456 The -XX:NewSize option is equivalent to -Xmn. -XX:ParallelGCThreads=threads Sets the number of the stop-the-world (STW) worker threads. The default value depends on the number of CPUs available to the JVM and the garbage collector selected. For example, to set the number of threads for G1 GC to 2, specify the following option: -XX:ParallelGCThreads=2 -XX:+ParallelRefProcEnabled Enables parallel reference processing. By default, this option is disabled. -XX:+PrintAdaptiveSizePolicy Enables printing of information about adaptive-generation sizing. By default, this option is disabled. -XX:+ScavengeBeforeFullGC Enables GC of the young generation before each full GC. This option is enabled by default. It is recommended that you don't disable it, because scavenging the young generation before a full GC can reduce the number of objects reachable from the old generation space into the young generation space. To disable GC of the young generation before each full GC, specify the option -XX:-ScavengeBeforeFullGC. -XX:SoftRefLRUPolicyMSPerMB=time Sets the amount of time (in milliseconds) a softly reachable object is kept active on the heap after the last time it was referenced. The default value is one second of lifetime per free megabyte in the heap. The -XX:SoftRefLRUPolicyMSPerMB option accepts integer values representing milliseconds per one megabyte of the current heap size (for Java HotSpot Client VM) or the maximum possible heap size (for Java HotSpot Server VM). This difference means that the Client VM tends to flush soft references rather than grow the heap, whereas the Server VM tends to grow the heap rather than flush soft references. In the latter case, the value of the -Xmx option has a significant effect on how quickly soft references are garbage collected. The following example shows how to set the value to 2.5 seconds: -XX:SoftRefLRUPolicyMSPerMB=2500 -XX:-ShrinkHeapInSteps Incrementally reduces the Java heap to the target size, specified by the option -XX:MaxHeapFreeRatio. This option is enabled by default. If disabled, then it immediately reduces the Java heap to the target size instead of requiring multiple garbage collection cycles. Disable this option if you want to minimize the Java heap size. You will likely encounter performance degradation when this option is disabled. See Performance Tuning Examples for a description of using the MaxHeapFreeRatio option to keep the Java heap small by reducing the dynamic footprint for embedded applications. -XX:StringDeduplicationAgeThreshold=threshold Identifies String objects reaching the specified age that are considered candidates for deduplication. An object's age is a measure of how many times it has survived garbage collection. This is sometimes referred to as tenuring. Note: String objects that are promoted to an old heap region before this age has been reached are always considered candidates for deduplication. The default value for this option is 3. See the -XX:+UseStringDeduplication option. -XX:SurvivorRatio=ratio Sets the ratio between eden space size and survivor space size. By default, this option is set to 8. The following example shows how to set the eden/survivor space ratio to 4: -XX:SurvivorRatio=4 -XX:TargetSurvivorRatio=percent Sets the desired percentage of survivor space (0 to 100) used after young garbage collection. By default, this option is set to 50%. The following example shows how to set the target survivor space ratio to 30%: -XX:TargetSurvivorRatio=30 -XX:TLABSize=size Sets the initial size (in bytes) of a thread-local allocation buffer (TLAB). Append the letter k or K to indicate kilobytes, m or M to indicate megabytes, or g or G to indicate gigabytes. If this option is set to 0, then the JVM selects the initial size automatically. The following example shows how to set the initial TLAB size to 512 KB: -XX:TLABSize=512k -XX:+UseAdaptiveSizePolicy Enables the use of adaptive generation sizing. This option is enabled by default. To disable adaptive generation sizing, specify -XX:-UseAdaptiveSizePolicy and set the size of the memory allocation pool explicitly. See the -XX:SurvivorRatio option. -XX:+UseG1GC Enables the use of the garbage-first (G1) garbage collector. It's a server-style garbage collector, targeted for multiprocessor machines with a large amount of RAM. This option meets GC pause time goals with high probability, while maintaining good throughput. The G1 collector is recommended for applications requiring large heaps (sizes of around 6 GB or larger) with limited GC latency requirements (a stable and predictable pause time below 0.5 seconds). By default, this option is enabled and G1 is used as the default garbage collector. -XX:+UseGCOverheadLimit Enables the use of a policy that limits the proportion of time spent by the JVM on GC before an OutOfMemoryError exception is thrown. This option is enabled, by default, and the parallel GC will throw an OutOfMemoryError if more than 98% of the total time is spent on garbage collection and less than 2% of the heap is recovered. When the heap is small, this feature can be used to prevent applications from running for long periods of time with little or no progress. To disable this option, specify the option -XX:-UseGCOverheadLimit. -XX:+UseNUMA Enables performance optimization of an application on a machine with nonuniform memory architecture (NUMA) by increasing the application's use of lower latency memory. By default, this option is disabled and no optimization for NUMA is made. The option is available only when the parallel garbage collector is used (-XX:+UseParallelGC). -XX:+UseParallelGC Enables the use of the parallel scavenge garbage collector (also known as the throughput collector) to improve the performance of your application by leveraging multiple processors. By default, this option is disabled and the default collector is used. -XX:+UseSerialGC Enables the use of the serial garbage collector. This is generally the best choice for small and simple applications that don't require any special functionality from garbage collection. By default, this option is disabled and the default collector is used. -XX:+UseStringDeduplication Enables string deduplication. By default, this option is disabled. To use this option, you must enable the garbage-first (G1) garbage collector. String deduplication reduces the memory footprint of String objects on the Java heap by taking advantage of the fact that many String objects are identical. Instead of each String object pointing to its own character array, identical String objects can point to and share the same character array. -XX:+UseTLAB Enables the use of thread-local allocation blocks (TLABs) in the young generation space. This option is enabled by default. To disable the use of TLABs, specify the option -XX:-UseTLAB. -XX:+UseZGC Enables the use of the Z garbage collector (ZGC). This is a low latency garbage collector, providing max pause times of a few milliseconds, at some throughput cost. Pause times are independent of what heap size is used. Supports heap sizes from 8MB to 16TB. -XX:ZAllocationSpikeTolerance=factor Sets the allocation spike tolerance for ZGC. By default, this option is set to 2.0. This factor describes the level of allocation spikes to expect. For example, using a factor of 3.0 means the current allocation rate can be expected to triple at any time. -XX:ZCollectionInterval=seconds Sets the maximum interval (in seconds) between two GC cycles when using ZGC. By default, this option is set to 0 (disabled). -XX:ZFragmentationLimit=percent Sets the maximum acceptable heap fragmentation (in percent) for ZGC. By default, this option is set to 25. Using a lower value will cause the heap to be compacted more aggressively, to reclaim more memory at the cost of using more CPU time. -XX:+ZProactive Enables proactive GC cycles when using ZGC. By default, this option is enabled. ZGC will start a proactive GC cycle if doing so is expected to have minimal impact on the running application. This is useful if the application is mostly idle or allocates very few objects, but you still want to keep the heap size down and allow reference processing to happen even when there are a lot of free space on the heap. -XX:+ZUncommit Enables uncommitting of unused heap memory when using ZGC. By default, this option is enabled. Uncommitting unused heap memory will lower the memory footprint of the JVM, and make that memory available for other processes to use. -XX:ZUncommitDelay=seconds Sets the amount of time (in seconds) that heap memory must have been unused before being uncommitted. By default, this option is set to 300 (5 minutes). Committing and uncommitting memory are relatively expensive operations. Using a lower value will cause heap memory to be uncommitted earlier, at the risk of soon having to commit it again. DEPRECATED JAVA OPTIONS These java options are deprecated and might be removed in a future JDK release. They're still accepted and acted upon, but a warning is issued when they're used. -Xfuture Enables strict class-file format checks that enforce close conformance to the class-file format specification. Developers should use this flag when developing new code. Stricter checks may become the default in future releases. -Xloggc:filename Sets the file to which verbose GC events information should be redirected for logging. The -Xloggc option overrides -verbose:gc if both are given with the same java command. -Xloggc:filename is replaced by -Xlog:gc:filename. See Enable Logging with the JVM Unified Logging Framework. Example: -Xlog:gc:garbage-collection.log -XX:+FlightRecorder Enables the use of Java Flight Recorder (JFR) during the runtime of the application. Since JDK 8u40 this option has not been required to use JFR. -XX:InitialRAMFraction=ratio Sets the initial amount of memory that the JVM may use for the Java heap before applying ergonomics heuristics as a ratio of the maximum amount determined as described in the -XX:MaxRAM option. The default value is 64. Use the option -XX:InitialRAMPercentage instead. -XX:MaxRAMFraction=ratio Sets the maximum amount of memory that the JVM may use for the Java heap before applying ergonomics heuristics as a fraction of the maximum amount determined as described in the -XX:MaxRAM option. The default value is 4. Specifying this option disables automatic use of compressed oops if the combined result of this and other options influencing the maximum amount of memory is larger than the range of memory addressable by compressed oops. See -XX:UseCompressedOops for further information about compressed oops. Use the option -XX:MaxRAMPercentage instead. -XX:MinRAMFraction=ratio Sets the maximum amount of memory that the JVM may use for the Java heap before applying ergonomics heuristics as a fraction of the maximum amount determined as described in the -XX:MaxRAM option for small heaps. A small heap is a heap of approximately 125 MB. The default value is 2. Use the option -XX:MinRAMPercentage instead. OBSOLETE JAVA OPTIONS These java options are still accepted but ignored, and a warning is issued when they're used. --illegal-access=parameter Controlled relaxed strong encapsulation, as defined in JEP 261 [https://openjdk.org/jeps/261#Relaxed-strong-encapsulation]. This option was deprecated in JDK 16 by JEP 396 [https://openjdk.org/jeps/396] and made obsolete in JDK 17 by JEP 403 [https://openjdk.org/jeps/403]. -XX:+UseHugeTLBFS Linux only: This option is the equivalent of specifying -XX:+UseLargePages. This option is disabled by default. This option pre-allocates all large pages up-front, when memory is reserved; consequently the JVM can't dynamically grow or shrink large pages memory areas; see -XX:UseTransparentHugePages if you want this behavior. -XX:+UseSHM Linux only: Enables the JVM to use shared memory to set up large pages. REMOVED JAVA OPTIONS No documented java options have been removed in JDK 22. For the lists and descriptions of options removed in previous releases see the Removed Java Options section in: • The java Command, Release 21 [https://docs.oracle.com/en/java/javase/21/docs/specs/man/java.html] • The java Command, Release 20 [https://docs.oracle.com/en/java/javase/20/docs/specs/man/java.html] • The java Command, Release 19 [https://docs.oracle.com/en/java/javase/19/docs/specs/man/java.html] • The java Command, Release 18 [https://docs.oracle.com/en/java/javase/18/docs/specs/man/java.html] • The java Command, Release 17 [https://docs.oracle.com/en/java/javase/17/docs/specs/man/java.html] • The java Command, Release 16 [https://docs.oracle.com/en/java/javase/16/docs/specs/man/java.html] • The java Command, Release 15 [https://docs.oracle.com/en/java/javase/15/docs/specs/man/java.html] • The java Command, Release 14 [https://docs.oracle.com/en/java/javase/14/docs/specs/man/java.html] • The java Command, Release 13 [https://docs.oracle.com/en/java/javase/13/docs/specs/man/java.html] • Java Platform, Standard Edition Tools Reference, Release 12 [https://docs.oracle.com/en/java/javase/12/tools/java.html#GUID-3B1CE181-CD30-4178-9602-230B800D4FAE] • Java Platform, Standard Edition Tools Reference, Release 11 [https://docs.oracle.com/en/java/javase/11/tools/java.html#GUID-741FC470-AA3E-494A-8D2B-1B1FE4A990D1] • Java Platform, Standard Edition Tools Reference, Release 10 [https://docs.oracle.com/javase/10/tools/java.htm#JSWOR624] • Java Platform, Standard Edition Tools Reference, Release 9 [https://docs.oracle.com/javase/9/tools/java.htm#JSWOR624] • Java Platform, Standard Edition Tools Reference, Release 8 for Oracle JDK on Windows [https://docs.oracle.com/javase/8/docs/technotes/tools/windows/java.html#BGBCIEFC] • Java Platform, Standard Edition Tools Reference, Release 8 for Oracle JDK on Solaris, Linux, and macOS [https://docs.oracle.com/javase/8/docs/technotes/tools/unix/java.html#BGBCIEFC] JAVA COMMAND-LINE ARGUMENT FILES You can shorten or simplify the java command by using @ argument files to specify one or more text files that contain arguments, such as options and class names, which are passed to the java command. This let's you to create java commands of any length on any operating system. In the command line, use the at sign (@) prefix to identify an argument file that contains java options and class names. When the java command encounters a file beginning with the at sign (@), it expands the contents of that file into an argument list just as they would be specified on the command line. The java launcher expands the argument file contents until it encounters the --disable-@files option. You can use the --disable-@files option anywhere on the command line, including in an argument file, to stop @ argument files expansion. The following items describe the syntax of java argument files: • The argument file must contain only ASCII characters or characters in system default encoding that's ASCII friendly, such as UTF-8. • The argument file size must not exceed MAXINT (2,147,483,647) bytes. • The launcher doesn't expand wildcards that are present within an argument file. • Use white space or new line characters to separate arguments included in the file. • White space includes a white space character, \t, \n, \r, and \f. For example, it is possible to have a path with a space, such as c:\Program Files that can be specified as either "c:\\Program Files" or, to avoid an escape, c:\Program" "Files. • Any option that contains spaces, such as a path component, must be within quotation marks using quotation ('"') characters in its entirety. • A string within quotation marks may contain the characters \n, \r, \t, and \f. They are converted to their respective ASCII codes. • If a file name contains embedded spaces, then put the whole file name in double quotation marks. • File names in an argument file are relative to the current directory, not to the location of the argument file. • Use the number sign # in the argument file to identify comments. All characters following the # are ignored until the end of line. • Additional at sign @ prefixes to @ prefixed options act as an escape, (the first @ is removed and the rest of the arguments are presented to the launcher literally). • Lines may be continued using the continuation character (\) at the end-of-line. The two lines are concatenated with the leading white spaces trimmed. To prevent trimming the leading white spaces, a continuation character (\) may be placed at the first column. • Because backslash (\) is an escape character, a backslash character must be escaped with another backslash character. • Partial quote is allowed and is closed by an end-of-file. • An open quote stops at end-of-line unless \ is the last character, which then joins the next line by removing all leading white space characters. • Wildcards (*) aren't allowed in these lists (such as specifying *.java). • Use of the at sign (@) to recursively interpret files isn't supported. Example of Open or Partial Quotes in an Argument File In the argument file, -cp "lib/ cool/ app/ jars this is interpreted as: -cp lib/cool/app/jars Example of a Backslash Character Escaped with Another Backslash Character in an Argument File To output the following: -cp c:\Program Files (x86)\Java\jre\lib\ext;c:\Program Files\Java\jre9\lib\ext The backslash character must be specified in the argument file as: -cp "c:\\Program Files (x86)\\Java\\jre\\lib\\ext;c:\\Program Files\\Java\\jre9\\lib\\ext" Example of an EOL Escape Used to Force Concatenation of Lines in an Argument File In the argument file, -cp "/lib/cool app/jars:\ /lib/another app/jars" This is interpreted as: -cp /lib/cool app/jars:/lib/another app/jars Example of Line Continuation with Leading Spaces in an Argument File In the argument file, -cp "/lib/cool\ \app/jars" This is interpreted as: -cp /lib/cool app/jars Examples of Using Single Argument File You can use a single argument file, such as myargumentfile in the following example, to hold all required java arguments: java @myargumentfile Examples of Using Argument Files with Paths You can include relative paths in argument files; however, they're relative to the current working directory and not to the paths of the argument files themselves. In the following example, path1/options and path2/options represent argument files with different paths. Any relative paths that they contain are relative to the current working directory and not to the argument files: java @path1/options @path2/classes CODE HEAP STATE ANALYTICS Overview There are occasions when having insight into the current state of the JVM code heap would be helpful to answer questions such as: • Why was the JIT turned off and then on again and again? • Where has all the code heap space gone? • Why is the method sweeper not working effectively? To provide this insight, a code heap state analytics feature has been implemented that enables on-the-fly analysis of the code heap. The analytics process is divided into two parts. The first part examines the entire code heap and aggregates all information that is believed to be useful or important. The second part consists of several independent steps that print the collected information with an emphasis on different aspects of the data. Data collection and printing are done on an "on request" basis. Syntax Requests for real-time, on-the-fly analysis can be issued with the following command: jcmd pid Compiler.CodeHeap_Analytics [function] [granularity] If you are only interested in how the code heap looks like after running a sample workload, you can use the command line option: -Xlog:codecache=Trace To see the code heap state when a "CodeCache full" condition exists, start the VM with the command line option: -Xlog:codecache=Debug See CodeHeap State Analytics (OpenJDK) [https://bugs.openjdk.org/secure/attachment/75649/JVM_CodeHeap_StateAnalytics_V2.pdf] for a detailed description of the code heap state analytics feature, the supported functions, and the granularity options. ENABLE LOGGING WITH THE JVM UNIFIED LOGGING FRAMEWORK You use the -Xlog option to configure or enable logging with the Java Virtual Machine (JVM) unified logging framework. The Java Virtual Machine (JVM) unified logging framework provides a common logging system for all components of the JVM. GC logging for the JVM has been changed to use the new logging framework. The mapping of old GC flags to the corresponding new Xlog configuration is described in Convert GC Logging Flags to Xlog. In addition, runtime logging has also been changed to use the JVM unified logging framework. The mapping of legacy runtime logging flags to the corresponding new Xlog configuration is described in Convert Runtime Logging Flags to Xlog. The following provides quick reference to the -Xlog command and syntax for options: -Xlog Enables JVM logging on an info level. -Xlog:help Prints -Xlog usage syntax and available tags, levels, and decorators along with example command lines with explanations. -Xlog:disable Turns off all logging and clears all configuration of the logging framework including the default configuration for warnings and errors. -Xlog[:option] Applies multiple arguments in the order that they appear on the command line. Multiple -Xlog arguments for the same output override each other in their given order. The option is set as: [tag- selection][:[output][:[decorators][:output-options]]] Omitting the tag-selection defaults to a tag-set of all and a level of info. tag[+...] all The all tag is a meta tag consisting of all tag-sets available. The asterisk * in a tag set definition denotes a wildcard tag match. Matching with a wildcard selects all tag sets that contain at least the specified tags. Without the wildcard, only exact matches of the specified tag sets are selected. output-options is filecount=file-count filesize=file size with optional K, M or G suffix foldmultilines=<true|false> When foldmultilines is true, a log event that consists of multiple lines will be folded into a single line by replacing newline characters with the sequence '\' and 'n' in the output. Existing single backslash characters will also be replaced with a sequence of two backslashes so that the conversion can be reversed. This option is safe to use with UTF-8 character encodings, but other encodings may not work. For example, it may incorrectly convert multi-byte sequences in Shift JIS and BIG5. Default Configuration When the -Xlog option and nothing else is specified on the command line, the default configuration is used. The default configuration logs all messages with a level that matches either warning or error regardless of what tags the message is associated with. The default configuration is equivalent to entering the following on the command line: -Xlog:all=warning:stdout:uptime,level,tags Controlling Logging at Runtime Logging can also be controlled at run time through Diagnostic Commands (with the jcmd utility). Everything that can be specified on the command line can also be specified dynamically with the VM.log command. As the diagnostic commands are automatically exposed as MBeans, you can use JMX to change logging configuration at run time. -Xlog Tags and Levels Each log message has a level and a tag set associated with it. The level of the message corresponds to its details, and the tag set corresponds to what the message contains or which JVM component it involves (such as, gc, jit, or os). Mapping GC flags to the Xlog configuration is described in Convert GC Logging Flags to Xlog. Mapping legacy runtime logging flags to the corresponding Xlog configuration is described in Convert Runtime Logging Flags to Xlog. Available log levels: • off • trace • debug • info • warning • error Available log tags: There are literally dozens of log tags, which in the right combinations, will enable a range of logging output. The full set of available log tags can be seen using -Xlog:help. Specifying all instead of a tag combination matches all tag combinations. -Xlog Output The -Xlog option supports the following types of outputs: • stdout --- Sends output to stdout • stderr --- Sends output to stderr • file=filename --- Sends output to text file(s). When using file=filename, specifying %p and/or %t in the file name expands to the JVM's PID and startup timestamp, respectively. You can also configure text files to handle file rotation based on file size and a number of files to rotate. For example, to rotate the log file every 10 MB and keep 5 files in rotation, specify the options filesize=10M, filecount=5. The target size of the files isn't guaranteed to be exact, it's just an approximate value. Files are rotated by default with up to 5 rotated files of target size 20 MB, unless configured otherwise. Specifying filecount=0 means that the log file shouldn't be rotated. There's a possibility of the pre-existing log file getting overwritten. -Xlog Output Mode By default logging messages are output synchronously - each log message is written to the designated output when the logging call is made. But you can instead use asynchronous logging mode by specifying: -Xlog:async Write all logging asynchronously. In asynchronous logging mode, log sites enqueue all logging messages to an intermediate buffer and a standalone thread is responsible for flushing them to the corresponding outputs. The intermediate buffer is bounded and on buffer exhaustion the enqueuing message is discarded. Log entry write operations are guaranteed non-blocking. The option -XX:AsyncLogBufferSize=N specifies the memory budget in bytes for the intermediate buffer. The default value should be big enough to cater for most cases. Users can provide a custom value to trade memory overhead for log accuracy if they need to. Decorations Logging messages are decorated with information about the message. You can configure each output to use a custom set of decorators. The order of the output is always the same as listed in the table. You can configure the decorations to be used at run time. Decorations are prepended to the log message. For example: [6.567s][info][gc,old] Old collection complete Omitting decorators defaults to uptime, level, and tags. The none decorator is special and is used to turn off all decorations. time (t), utctime (utc), uptime (u), timemillis (tm), uptimemillis (um), timenanos (tn), uptimenanos (un), hostname (hn), pid (p), tid (ti), level (l), tags (tg) decorators can also be specified as none for no decoration. Logging Messages Decorations Decorations Description ────────────────────────────────────────────────────────────────────────── time or t Current time and date in ISO-8601 format. utctime or utc Universal Time Coordinated or Coordinated Universal Time. uptime or u Time since the start of the JVM in seconds and milliseconds. For example, 6.567s. timemillis or The same value as generated by tm System.currentTimeMillis() uptimemillis or Milliseconds since the JVM started. um timenanos or tn The same value generated by System.nanoTime(). uptimenanos or Nanoseconds since the JVM started. un hostname or hn The host name. pid or p The process identifier. tid or ti The thread identifier. level or l The level associated with the log message. tags or tg The tag-set associated with the log message. Convert GC Logging Flags to Xlog Legacy GC Logging Flags to Xlog Configuration Mapping Legacy Garbage Collection (GC) Xlog Configuration Comment Flag ───────────────────────────────────────────────────────────────────────────────────────────────────── G1PrintHeapRegions -Xlog:gc+region=trace Not Applicable GCLogFileSize No configuration available Log rotation is handled by the framework. NumberOfGCLogFiles Not Applicable Log rotation is handled by the framework. PrintAdaptiveSizePolicy -Xlog:gc+ergo*=level Use a level of debug for most of the information, or a level of trace for all of what was logged for PrintAdaptiveSizePolicy. PrintGC -Xlog:gc Not Applicable PrintGCApplicationConcurrentTime -Xlog:safepoint Note that PrintGCApplicationConcurrentTime and PrintGCApplicationStoppedTime are logged on the same tag and aren't separated in the new logging. PrintGCApplicationStoppedTime -Xlog:safepoint Note that PrintGCApplicationConcurrentTime and PrintGCApplicationStoppedTime are logged on the same tag and not separated in the new logging. PrintGCCause Not Applicable GC cause is now always logged. PrintGCDateStamps Not Applicable Date stamps are logged by the framework. PrintGCDetails -Xlog:gc* Not Applicable PrintGCID Not Applicable GC ID is now always logged. PrintGCTaskTimeStamps -Xlog:gc+task*=debug Not Applicable PrintGCTimeStamps Not Applicable Time stamps are logged by the framework. PrintHeapAtGC -Xlog:gc+heap=trace Not Applicable PrintReferenceGC -Xlog:gc+ref*=debug Note that in the old logging, PrintReferenceGC had an effect only if PrintGCDetails was also enabled. PrintStringDeduplicationStatistics `-Xlog:gc+stringdedup*=debug ` Not Applicable PrintTenuringDistribution -Xlog:gc+age*=level Use a level of debug for the most relevant information, or a level of trace for all of what was logged for PrintTenuringDistribution. UseGCLogFileRotation Not Applicable What was logged for PrintTenuringDistribution. Convert Runtime Logging Flags to Xlog These legacy flags are no longer recognized and will cause an error if used directly. Use their unified logging equivalent instead. Runtime Logging Flags to Xlog Configuration Mapping Legacy Runtime Flag Xlog Configuration Comment ─────────────────────────────────────────────────────────────────────────────────────────────────────────── TraceExceptions -Xlog:exceptions=info Not Applicable TraceClassLoading -Xlog:class+load=level Use level=info for regular information, or level=debug for additional information. In Unified Logging syntax, -verbose:class equals -Xlog:class+load=info,class+unload=info. TraceClassLoadingPreorder -Xlog:class+preorder=debug Not Applicable TraceClassUnloading -Xlog:class+unload=level Use level=info for regular information, or level=trace for additional information. In Unified Logging syntax, -verbose:class equals -Xlog:class+load=info,class+unload=info. VerboseVerification -Xlog:verification=info Not Applicable TraceClassPaths -Xlog:class+path=info Not Applicable TraceClassResolution -Xlog:class+resolve=debug Not Applicable TraceClassInitialization -Xlog:class+init=info Not Applicable TraceLoaderConstraints -Xlog:class+loader+constraints=info Not Applicable TraceClassLoaderData -Xlog:class+loader+data=level Use level=debug for regular information or level=trace for additional information. TraceSafepointCleanupTime -Xlog:safepoint+cleanup=info Not Applicable TraceSafepoint -Xlog:safepoint=debug Not Applicable TraceMonitorInflation -Xlog:monitorinflation=debug Not Applicable TraceRedefineClasses -Xlog:redefine+class*=level level=info, debug, and trace provide increasing amounts of information. -Xlog Usage Examples The following are -Xlog examples. -Xlog Logs all messages by using the info level to stdout with uptime, levels, and tags decorations. This is equivalent to using: -Xlog:all=info:stdout:uptime,levels,tags -Xlog:gc Logs messages tagged with the gc tag using info level to stdout. The default configuration for all other messages at level warning is in effect. -Xlog:gc,safepoint Logs messages tagged either with the gc or safepoint tags, both using the info level, to stdout, with default decorations. Messages tagged with both gc and safepoint won't be logged. -Xlog:gc+ref=debug Logs messages tagged with both gc and ref tags, using the debug level to stdout, with default decorations. Messages tagged only with one of the two tags won't be logged. -Xlog:gc=debug:file=gc.txt:none Logs messages tagged with the gc tag using the debug level to a file called gc.txt with no decorations. The default configuration for all other messages at level warning is still in effect. -Xlog:gc=trace:file=gctrace.txt:uptimemillis,pids:filecount=5,filesize=1024 Logs messages tagged with the gc tag using the trace level to a rotating file set with 5 files with size 1 MB with the base name gctrace.txt and uses decorations uptimemillis and pid. The default configuration for all other messages at level warning is still in effect. -Xlog:gc::uptime,tid Logs messages tagged with the gc tag using the default 'info' level to default the output stdout and uses decorations uptime and tid. The default configuration for all other messages at level warning is still in effect. -Xlog:gc*=info,safepoint*=off Logs messages tagged with at least gc using the info level, but turns off logging of messages tagged with safepoint. Messages tagged with both gc and safepoint won't be logged. -Xlog:disable -Xlog:safepoint=trace:safepointtrace.txt Turns off all logging, including warnings and errors, and then enables messages tagged with safepointusing tracelevel to the file safepointtrace.txt. The default configuration doesn't apply, because the command line started with -Xlog:disable. Complex -Xlog Usage Examples The following describes a few complex examples of using the -Xlog option. -Xlog:gc+class*=debug Logs messages tagged with at least gc and class tags using the debug level to stdout. The default configuration for all other messages at the level warning is still in effect -Xlog:gc+meta*=trace,class*=off:file=gcmetatrace.txt Logs messages tagged with at least the gc and meta tags using the trace level to the file metatrace.txt but turns off all messages tagged with class. Messages tagged with gc, meta, and class aren't be logged as class* is set to off. The default configuration for all other messages at level warning is in effect except for those that include class. -Xlog:gc+meta=trace Logs messages tagged with exactly the gc and meta tags using the trace level to stdout. The default configuration for all other messages at level warning is still be in effect. -Xlog:gc+class+heap*=debug,meta*=warning,threads*=off Logs messages tagged with at least gc, class, and heap tags using the trace level to stdout but only log messages tagged with meta with level. The default configuration for all other messages at the level warning is in effect except for those that include threads. VALIDATE JAVA VIRTUAL MACHINE FLAG ARGUMENTS You use values provided to all Java Virtual Machine (JVM) command-line flags for validation and, if the input value is invalid or out-of- range, then an appropriate error message is displayed. Whether they're set ergonomically, in a command line, by an input tool, or through the APIs (for example, classes contained in the package java.lang.management) the values provided to all Java Virtual Machine (JVM) command-line flags are validated. Ergonomics are described in Java Platform, Standard Edition HotSpot Virtual Machine Garbage Collection Tuning Guide. Range and constraints are validated either when all flags have their values set during JVM initialization or a flag's value is changed during runtime (for example using the jcmd tool). The JVM is terminated if a value violates either the range or constraint check and an appropriate error message is printed on the error stream. For example, if a flag violates a range or a constraint check, then the JVM exits with an error: java -XX:AllocatePrefetchStyle=5 -version intx AllocatePrefetchStyle=5 is outside the allowed range [ 0 ... 3 ] Improperly specified VM option 'AllocatePrefetchStyle=5' Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit. The flag -XX:+PrintFlagsRanges prints the range of all the flags. This flag allows automatic testing of the flags by the values provided by the ranges. For the flags that have the ranges specified, the type, name, and the actual range is printed in the output. For example, intx ThreadStackSize [ 0 ... 9007199254740987 ] {pd product} For the flags that don't have the range specified, the values aren't displayed in the print out. For example: size_t NewSize [ ... ] {product} This helps to identify the flags that need to be implemented. The automatic testing framework can skip those flags that don't have values and aren't implemented. LARGE PAGES You use large pages, also known as huge pages, as memory pages that are significantly larger than the standard memory page size (which varies depending on the processor and operating system). Large pages optimize processor Translation-Lookaside Buffers. A Translation-Lookaside Buffer (TLB) is a page translation cache that holds the most-recently used virtual-to-physical address translations. A TLB is a scarce system resource. A TLB miss can be costly because the processor must then read from the hierarchical page table, which may require multiple memory accesses. By using a larger memory page size, a single TLB entry can represent a larger memory range. This results in less pressure on a TLB, and memory-intensive applications may have better performance. However, using large pages can negatively affect system performance. For example, when a large amount of memory is pinned by an application, it may create a shortage of regular memory and cause excessive paging in other applications and slow down the entire system. Also, a system that has been up for a long time could produce excessive fragmentation, which could make it impossible to reserve enough large page memory. When this happens, either the OS or JVM reverts to using regular pages. Linux and Windows support large pages. Large Pages Support for Linux Linux supports large pages since version 2.6. To check if your environment supports large pages, try the following: # cat /proc/meminfo | grep Huge HugePages_Total: 0 HugePages_Free: 0 ... Hugepagesize: 2048 kB If the output contains items prefixed with "Huge", then your system supports large pages. The values may vary depending on environment. The Hugepagesize field shows the default large page size in your environment, and the other fields show details for large pages of this size. Newer kernels have support for multiple large page sizes. To list the supported page sizes, run this: # ls /sys/kernel/mm/hugepages/ hugepages-1048576kB hugepages-2048kB The above environment supports 2 MB and 1 GB large pages, but they need to be configured so that the JVM can use them. When using large pages and not enabling transparent huge pages (option -XX:+UseTransparentHugePages), the number of large pages must be pre- allocated. For example, to enable 8 GB of memory to be backed by 2 MB large pages, login as root and run: # echo 4096 > /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages It is always recommended to check the value of nr_hugepages after the request to make sure the kernel was able to allocate the requested number of large pages. Note: The values contained in /proc and /sys reset after you reboot your system, so may want to set them in an initialization script (for example, rc.local or sysctl.conf). If you configure the OS kernel parameters to enable use of large pages, the Java processes may allocate large pages for the Java heap as well as other internal areas, for example: • Code cache • Marking bitmaps Consequently, if you configure the nr_hugepages parameter to the size of the Java heap, then the JVM can still fail to allocate the heap using large pages because other areas such as the code cache might already have used some of the configured large pages. Large Pages Support for Windows To use large pages support on Windows, the administrator must first assign additional privileges to the user who is running the application: 1. Select Control Panel, Administrative Tools, and then Local Security Policy. 2. Select Local Policies and then User Rights Assignment. 3. Double-click Lock pages in memory, then add users and/or groups. 4. Reboot your system. Note that these steps are required even if it's the administrator who's running the application, because administrators by default don't have the privilege to lock pages in memory. APPLICATION CLASS DATA SHARING Application Class Data Sharing (AppCDS) stores classes used by your applications in an archive file. Since these classes are stored in a format that can be loaded very quickly (compared to classes stored in a JAR file), AppCDS can improve the start-up time of your applications. In addition, AppCDS can reduce the runtime memory footprint by sharing parts of these classes across multiple processes. Classes in the CDS archive are stored in an optimized format that's about 2 to 5 times larger than classes stored in JAR files or the JDK runtime image. Therefore, it's a good idea to archive only those classes that are actually used by your application. These usually are just a small portion of all available classes. For example, your application may use only a few APIs provided by a large library. Using CDS Archives By default, in most JDK distributions, unless -Xshare:off is specified, the JVM starts up with a default CDS archive, which is usually located in JAVA_HOME/lib/server/classes.jsa (or JAVA_HOME\bin\server\classes.jsa on Windows). This archive contains about 1300 core library classes that are used by most applications. To use CDS for the exact set of classes used by your application, you can use the -XX:SharedArchiveFile option, which has the general form: -XX:SharedArchiveFile=<static_archive>:<dynamic_archive> • The <static_archive> overrides the default CDS archive. • The <dynamic_archive> provides additional classes that can be loaded on top of those in the <static_archive>. • On Windows, the above path delimiter : should be replaced with ; (The names "static" and "dynamic" are used for historical reasons. The only significance is that the "static" archive is loaded first and the "dynamic" archive is loaded second). The JVM can use up to two archives. To use only a single <static_archive>, you can omit the <dynamic_archive> portion: -XX:SharedArchiveFile=<static_archive> For convenience, the <dynamic_archive> records the location of the <static_archive>. Therefore, you can omit the <static_archive> by saying only: -XX:SharedArchiveFile=<dynamic_archive> Manually Creating CDS Archives CDS archives can be created manually using several methods: • -Xshare:dump • -XX:ArchiveClassesAtExit • jcmd VM.cds One common operation in all these methods is a "trial run", where you run the application once to determine the classes that should be stored in the archive. Creating a Static CDS Archive File with -Xshare:dump The following steps create a static CDS archive file that contains all the classes used by the test.Hello application. 1. Create a list of all classes used by the test.Hello application. The following command creates a file named hello.classlist that contains a list of all classes used by this application: java -Xshare:off -XX:DumpLoadedClassList=hello.classlist -cp hello.jar test.Hello The classpath specified by the -cp parameter must contain only JAR files. 2. Create a static archive, named hello.jsa, that contains all the classes in hello.classlist: java -Xshare:dump -XX:SharedArchiveFile=hello.jsa -XX:SharedClassListFile=hello.classlist -cp hello.jar 3. Run the application test.Hello with the archive hello.jsa: java -XX:SharedArchiveFile=hello.jsa -cp hello.jar test.Hello 4. Optional Verify that the test.Hello application is using the class contained in the hello.jsa shared archive: java -XX:SharedArchiveFile=hello.jsa -cp hello.jar -Xlog:class+load test.Hello The output of this command should contain the following text: [info][class,load] test.Hello source: shared objects file By default, when the -Xshare:dump option is used, the JVM runs in interpreter-only mode (as if the -Xint option were specified). This is required for generating deterministic output in the shared archive file. I.e., the exact same archive will be generated, bit-for-bit, every time you dump it. However, if deterministic output is not needed, and you have a large classlist, you can explicitly add -Xmixed to the command-line to enable the JIT compiler. This will speed up the archive creation. Creating a Dynamic CDS Archive File with -XX:ArchiveClassesAtExit Advantages of dynamic CDS archives are: • They usually use less disk space, since they don't need to store the classes that are already in the static archive. • They are created with one fewer step than the comparable static archive. The following steps create a dynamic CDS archive file that contains the classes that are used by the test.Hello application, excluding those that are already in the default CDS archive. 1. Create a dynamic CDS archive, named hello.jsa, that contains all the classes in hello.jar loaded by the application test.Hello: java -XX:ArchiveClassesAtExit=hello.jsa -cp hello.jar Hello 2. Run the application test.Hello with the shared archive hello.jsa: java -XX:SharedArchiveFile=hello.jsa -cp hello.jar test.Hello 3. Optional Repeat step 4 of the previous section to verify that the test.Hello application is using the class contained in the hello.jsa shared archive. It's also possible to create a dynamic CDS archive with a non-default static CDS archive. E.g., java -XX:SharedArchiveFile=base.jsa -XX:ArchiveClassesAtExit=hello.jsa -cp hello.jar Hello To run the application using this dynamic CDS archive: java -XX:SharedArchiveFile=base.jsa:hello.jsa -cp hello.jar Hello (On Windows, the above path delimiter : should be replaced with ;) As mention above, the name of the static archive can be skipped: java -XX:SharedArchiveFile=hello.jsa -cp hello.jar Hello Creating CDS Archive Files with jcmd The previous two sections require you to modify the application's start-up script in order to create a CDS archive. Sometimes this could be difficult, for example, if the application's class path is set up by complex routines. The jcmd VM.cds command provides a less intrusive way for creating a CDS archive by connecting to a running JVM process. You can create either a static: jcmd <pid> VM.cds static_dump my_static_archive.jsa or a dynamic archive: jcmd <pid> VM.cds dynamic_dump my_dynamic_archive.jsa To use the resulting archive file in a subsequent run of the application without modifying the application's start-up script, you can use the following technique: env JAVA_TOOL_OPTIONS=-XX:SharedArchiveFile=my_static_archive.jsa bash app_start.sh Note: to use jcmd <pid> VM.cds dynamic_dump, the JVM process identified by <pid> must be started with -XX:+RecordDynamicDumpInfo, which can also be passed to the application start-up script with the same technique: env JAVA_TOOL_OPTIONS=-XX:+RecordDynamicDumpInfo bash app_start.sh Creating Dynamic CDS Archive File with -XX:+AutoCreateSharedArchive -XX:+AutoCreateSharedArchive is a more convenient way of creating/using CDS archives. Unlike the methods of manual CDS archive creation described in the previous section, with -XX:+AutoCreateSharedArchive, it's no longer necessary to have a separate trial run. Instead, you can always run the application with the same command-line and enjoy the benefits of CDS automatically. java -XX:+AutoCreateSharedArchive -XX:SharedArchiveFile=hello.jsa -cp hello.jar Hello If the specified archive file exists and was created by the same version of the JDK, then it will be loaded as a dynamic archive; otherwise it is ignored at VM startup. At VM exit, if the specified archive file does not exist, it will be created. If it exists but was created with a different (but post JDK 19) version of the JDK, then it will be replaced. In both cases the archive will be ready to be loaded the next time the JVM is launched with the same command line. If the specified archive file exists but was created by a JDK version prior to JDK 19, then it will be ignored: neither loaded at startup, nor replaced at exit. Developers should note that the contents of the CDS archive file are specific to each build of the JDK. Therefore, if you switch to a different JDK build, -XX:+AutoCreateSharedArchive will automatically recreate the archive to match the JDK. If you intend to use this feature with an existing archive, you should make sure that the archive is created by at least version 19 of the JDK. Restrictions on Class Path and Module Path • Neither the class path (-classpath and -Xbootclasspath/a) nor the module path (--module-path) can contain non-empty directories. • Only modular JAR files are supported in --module-path. Exploded modules are not supported. • The class path used at archive creation time must be the same as (or a prefix of) the class path used at run time. (There's no such requirement for the module path.) • The CDS archive cannot be loaded if any JAR files in the class path or module path are modified after the archive is generated. • If any of the VM options --upgrade-module-path, --patch-module or --limit-modules are specified, CDS is disabled. This means that the JVM will execute without loading any CDS archives. In addition, if you try to create a CDS archive with any of these 3 options specified, the JVM will report an error. PERFORMANCE TUNING EXAMPLES You can use the Java advanced runtime options to optimize the performance of your applications. Tuning for Higher Throughput Use the following commands and advanced options to achieve higher throughput performance for your application: java -server -XX:+UseParallelGC -XX:+UseLargePages -Xmn10g -Xms26g -Xmx26g Tuning for Lower Response Time Use the following commands and advanced options to achieve lower response times for your application: java -XX:+UseG1GC -XX:MaxGCPauseMillis=100 Keeping the Java Heap Small and Reducing the Dynamic Footprint of Embedded Applications Use the following advanced runtime options to keep the Java heap small and reduce the dynamic footprint of embedded applications: -XX:MaxHeapFreeRatio=10 -XX:MinHeapFreeRatio=5 Note: The defaults for these two options are 70% and 40% respectively. Because performance sacrifices can occur when using these small settings, you should optimize for a small footprint by reducing these settings as much as possible without introducing unacceptable performance degradation. EXIT STATUS The following exit values are typically returned by the launcher when the launcher is called with the wrong arguments, serious errors, or exceptions thrown by the JVM. However, a Java application may choose to return any value by using the API call System.exit(exitValue). The values are: • 0: Successful completion • >0: An error occurred JDK 22 2024 JAVA(1)
java - launch a Java application
To launch a class file: java [options] mainclass [args ...] To launch the main class in a JAR file: java [options] -jar jarfile [args ...] To launch the main class in a module: java [options] -m module[/mainclass] [args ...] or java [options] --module module[/mainclass] [args ...] To launch a source-file program: java [options] source-file [args ...] -Xlog[:[what][:[output][:[decorators][:output-options[,...]]]]] -Xlog:directive what Specifies a combination of tags and levels of the form tag1[+tag2...][*][=level][,...]. Unless the wildcard (*) is specified, only log messages tagged with exactly the tags specified are matched. See -Xlog Tags and Levels. output Sets the type of output. Omitting the output type defaults to stdout. See -Xlog Output. decorators Configures the output to use a custom set of decorators. Omitting decorators defaults to uptime, level, and tags. See Decorations. output-options Sets the -Xlog logging output options. directive A global option or subcommand: help, disable, async
Optional: Specifies command-line options separated by spaces. See Overview of Java Options for a description of available options. mainclass Specifies the name of the class to be launched. Command-line entries following classname are the arguments for the main method. -jar jarfile Executes a program encapsulated in a JAR file. The jarfile argument is the name of a JAR file with a manifest that contains a line in the form Main-Class:classname that defines the class with the public static void main(String[] args) method that serves as your application's starting point. When you use -jar, the specified JAR file is the source of all user classes, and other class path settings are ignored. If you're using JAR files, then see jar. -m or --module module[/mainclass] Executes the main class in a module specified by mainclass if it is given, or, if it is not given, the value in the module. In other words, mainclass can be used when it is not specified by the module, or to override the value when it is specified. See Standard Options for Java. source-file Only used to launch a source-file program. Specifies the source file that contains the main class when using source-file mode. See Using Source-File Mode to Launch Source-Code Programs args ... Optional: Arguments following mainclass, source-file, -jar jarfile, and -m or --module module/mainclass are passed as arguments to the main class.
null
jhsdb
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. JDK 22 2024 JHSDB(1)
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)
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 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).
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.
null
javap
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. -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. -Joption 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. 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 } JDK 22 2024 JAVAP(1)
javap - disassemble one or more class files
javap [options] classes...
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
null
jdeprscan
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 JDK 22 2024 JDEPRSCAN(1)
jdeprscan - static analysis tool that scans a jar file (or some other aggregation of class files) for uses of deprecated API elements
jdeprscan [options] {dir|jar|class}
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
null
javac
The javac command reads source files that contain module, package and type declarations written in the Java programming language, and compiles them into class files that run on the Java Virtual Machine. The javac command can also process annotations in Java source files and classes. Source files must have a file name extension of .java. Class files have a file name extension of .class. Both source and class files normally have file names that identify the contents. For example, a class called Shape would be declared in a source file called Shape.java, and compiled into a class file called Shape.class. There are two ways to specify source files to javac: • For a small number of source files, you can list their file names on the command line. • For a large number of source files, you can use the @filename option on the command line to specify an argument file that lists their file names. See Standard Options for a description of the option and Command-Line Argument Files for a description of javac argument files. The order of source files specified on the command line or in an argument file is not important. javac will compile the files together, as a group, and will automatically resolve any dependencies between the declarations in the various source files. javac expects that source files are arranged in one or more directory hierarchies on the file system, described in Arrangement of Source Code. To compile a source file, javac needs to find the declaration of every class or interface that is used, extended, or implemented by the code in the source file. This lets javac check that the code has the right to access those classes and interfaces. Rather than specifying the source files of those classes and interfaces explicitly, you can use command-line options to tell javac where to search for their source files. If you have compiled those source files previously, you can use options to tell javac where to search for the corresponding class files. The options, which all have names ending in "path", are described in Standard Options, and further described in Configuring a Compilation and Searching for Module, Package and Type Declarations. By default, javac compiles each source file to a class file in the same directory as the source file. However, it is recommended to specify a separate destination directory with the -d option. Command-line options and environment variables also control how javac performs various tasks: • Compiling code to run on earlier releases of the JDK. • Compiling code to run under a debugger. • Checking for stylistic issues in Java source code. • Checking for problems in javadoc comments (/** ... */). • Processing annotations in source files and class files. • Upgrading and patching modules in the compile-time environment. javac supports Compiling for Earlier Releases Of The Platform and can also be invoked from Java code using one of a number of APIs
javac - read Java declarations and compile them into class files
javac [options] [sourcefiles-or-classnames]
Command-line options. sourcefiles-or-classnames Source files to be compiled (for example, Shape.java) or the names of previously compiled classes to be processed for annotations (for example, geometry.MyShape). javac provides standard options, and extra options that are either non- standard or are for advanced use. Some options take one or more arguments. If an argument contains spaces or other whitespace characters, the value should be quoted according to the conventions of the environment being used to invoke javac. If the option begins with a single dash (-) the argument should either directly follow the option name, or should be separated with a colon (:) or whitespace, depending on the option. If the option begins with a double dash (--), the argument may be separated either by whitespace or by an equals (=) character with no additional whitespace. For example, -Aname="J. Duke" -proc:only -d myDirectory --module-version 3 --module-version=3 In the following lists of options, an argument of path represents a search path, composed of a list of file system locations separated by the platform path separator character, (semicolon ; on Windows, or colon : on other systems.) Depending on the option, the file system locations may be directories, JAR files or JMOD files. Standard Options @filename Reads options and file names from a file. To shorten or simplify the javac command, you can specify one or more files that contain arguments to the javac command (except -J options). This lets you to create javac commands of any length on any operating system. See Command-Line Argument Files. -Akey[=value] Specifies options to pass to annotation processors. These options are not interpreted by javac directly, but are made available for use by individual processors. The key value should be one or more identifiers separated by a dot (.). --add-modules module,module Specifies root modules to resolve in addition to the initial modules, or all modules on the module path if module is ALL-MODULE-PATH. --boot-class-path path or -bootclasspath path Overrides the location of the bootstrap class files. Note: This can only be used when compiling for releases prior to JDK 9. As applicable, see the descriptions in --release, -source, or -target for details. For JDK 9 or later, see --system. --class-path path, -classpath path, or -cp path Specifies where to find user class files and annotation processors. This class path overrides the user class path in the CLASSPATH environment variable. • If --class-path, -classpath, or -cp are not specified, then the user class path is the value of the CLASSPATH environment variable, if that is set, or else the current directory. • If not compiling code for modules, if the --source-path or -sourcepath` option is not specified, then the user class path is also searched for source files. • If the -processorpath option is not specified, then the class path is also searched for annotation processors. -d directory Sets the destination directory (or class output directory) for class files. If a class is part of a package, then javac puts the class file in a subdirectory that reflects the module name (if appropriate) and package name. The directory, and any necessary subdirectories, will be created if they do not already exist. If the -d option is not specified, then javac puts each class file in the same directory as the source file from which it was generated. Except when compiling code for multiple modules, the contents of the class output directory will be organized in a package hierarchy. When compiling code for multiple modules, the contents of the output directory will be organized in a module hierarchy, with the contents of each module in a separate subdirectory, each organized as a package hierarchy. Note: When compiling code for one or more modules, the class output directory will automatically be checked when searching for previously compiled classes. When not compiling for modules, for backwards compatibility, the directory is not automatically checked for previously compiled classes, and so it is recommended to specify the class output directory as one of the locations on the user class path, using the --class-path option or one of its alternate forms. -deprecation Shows a description of each use or override of a deprecated member or class. Without the -deprecation option, javac shows a summary of the source files that use or override deprecated members or classes. The -deprecation option is shorthand for -Xlint:deprecation. --enable-preview Enables preview language features. Used in conjunction with either -source or --release. -encoding encoding Specifies character encoding used by source files, such as EUC- JP and UTF-8. If the -encoding option is not specified, then the platform default converter is used. -endorseddirs directories Overrides the location of the endorsed standards path. Note: This can only be used when compiling for releases prior to JDK 9. As applicable, see the descriptions in --release, -source, or -target for details. -extdirs directories Overrides the location of the installed extensions. directories is a list of directories, separated by the platform path separator (; on Windows, and : otherwise). Each JAR file in the specified directories is searched for class files. All JAR files found become part of the class path. If you are compiling for a release of the platform that supports the Extension Mechanism, then this option specifies the directories that contain the extension classes. See [Compiling for Other Releases of the Platform]. Note: This can only be used when compiling for releases prior to JDK 9. As applicable, see the descriptions in --release, -source, or -target for details. -g Generates all debugging information, including local variables. By default, only line number and source file information is generated. -g:[lines, vars, source] Generates only the kinds of debugging information specified by the comma-separated list of keywords. Valid keywords are: lines Line number debugging information. vars Local variable debugging information. source Source file debugging information. -g:none Does not generate debugging information. -h directory Specifies where to place generated native header files. When you specify this option, a native header file is generated for each class that contains native methods or that has one or more constants annotated with the java.lang.annotation.Native annotation. If the class is part of a package, then the compiler puts the native header file in a subdirectory that reflects the module name (if appropriate) and package name. The directory, and any necessary subdirectories, will be created if they do not already exist. --help, -help or -? Prints a synopsis of the standard options. --help-extra or -X Prints a synopsis of the set of extra options. --help-lint Prints the supported keys for the -Xlint option. -implicit:[none, class] Specifies whether or not to generate class files for implicitly referenced files: • -implicit:class --- Automatically generates class files. • -implicit:none --- Suppresses class file generation. If this option is not specified, then the default automatically generates class files. In this case, the compiler issues a warning if any class files are generated when also doing annotation processing. The warning is not issued when the -implicit option is explicitly set. See Searching for Module, Package and Type Declarations. -Joption Passes option to the runtime system, where option is one of the Java options described on java command. For example, -J-Xms48m sets the startup memory to 48 MB. Note: The CLASSPATH environment variable, -classpath option, -bootclasspath option, and -extdirs option do not specify the classes used to run javac. Trying to customize the compiler implementation with these options and variables is risky and often does not accomplish what you want. If you must customize the compiler implementation, then use the -J option to pass options through to the underlying Java launcher. --limit-modules module,module* Limits the universe of observable modules. --module module-name (,module-name)* or -m module-name (,module-name)* Compiles those source files in the named modules that are newer than the corresponding files in the output directory. --module-path path or -p path Specifies where to find application modules. --module-source-path module-source-path Specifies where to find source files when compiling code in multiple modules. See [Compilation Modes] and The Module Source Path Option. --module-version version Specifies the version of modules that are being compiled. -nowarn Disables warning messages. This option operates the same as the -Xlint:none option. -parameters Generates metadata for reflection on method parameters. Stores formal parameter names of constructors and methods in the generated class file so that the method java.lang.reflect.Executable.getParameters from the Reflection API can retrieve them. -proc:[none, only, full] Controls whether annotation processing and compilation are done. -proc:none means that compilation takes place without annotation processing. -proc:only means that only annotation processing is done, without any subsequent compilation. If this option is not used, or -proc:full is specified, annotation processing and compilation are done. -processor class1[,class2,class3...] Names of the annotation processors to run. This bypasses the default discovery process. --processor-module-path path Specifies the module path used for finding annotation processors. --processor-path path or -processorpath path Specifies where to find annotation processors. If this option is not used, then the class path is searched for processors. -profile profile Checks that the API used is available in the specified profile. This option is deprecated and may be removed in a future release. Note: This can only be used when compiling for releases prior to JDK 9. As applicable, see the descriptions in --release, -source, or -target for details. --release release Compiles source code according to the rules of the Java programming language for the specified Java SE release, generating class files which target that release. Source code is compiled against the combined Java SE and JDK API for the specified release. The supported values of release are the current Java SE release and a limited number of previous releases, detailed in the command-line help. For the current release, the Java SE API consists of the java.*, javax.*, and org.* packages that are exported by the Java SE modules in the release; the JDK API consists of the com.* and jdk.* packages that are exported by the JDK modules in the release, plus the javax.* packages that are exported by standard, but non-Java SE, modules in the release. For previous releases, the Java SE API and the JDK API are as defined in that release. Note: When using --release, you cannot also use the --source/-source or --target/-target options. Note: When using --release to specify a release that supports the Java Platform Module System, the --add-exports option cannot be used to enlarge the set of packages exported by the Java SE, JDK, and standard modules in the specified release. -s directory Specifies the directory used to place the generated source files. If a class is part of a package, then the compiler puts the source file in a subdirectory that reflects the module name (if appropriate) and package name. The directory, and any necessary subdirectories, will be created if they do not already exist. Except when compiling code for multiple modules, the contents of the source output directory will be organized in a package hierarchy. When compiling code for multiple modules, the contents of the source output directory will be organized in a module hierarchy, with the contents of each module in a separate subdirectory, each organized as a package hierarchy. --source release or -source release Compiles source code according to the rules of the Java programming language for the specified Java SE release. The supported values of release are the current Java SE release and a limited number of previous releases, detailed in the command- line help. If the option is not specified, the default is to compile source code according to the rules of the Java programming language for the current Java SE release. --source-path path or -sourcepath path Specifies where to find source files. Except when compiling multiple modules together, this is the source code path used to search for class or interface definitions. Note: Classes found through the class path might be recompiled when their source files are also found. See Searching for Module, Package and Type Declarations. --system jdk | none Overrides the location of system modules. --target release or -target release Generates class files suitable for the specified Java SE release. The supported values of release are the current Java SE release and a limited number of previous releases, detailed in the command-line help. Note: The target release must be equal to or higher than the source release. (See --source.) --upgrade-module-path path Overrides the location of upgradeable modules. -verbose Outputs messages about what the compiler is doing. Messages include information about each class loaded and each source file compiled. --version or -version Prints version information. -Werror Terminates compilation when warnings occur. Extra Options --add-exports module/package=other-module(,other-module)* Specifies a package to be considered as exported from its defining module to additional modules or to all unnamed modules when the value of other-module is ALL-UNNAMED. --add-reads module=other-module(,other-module)* Specifies additional modules to be considered as required by a given module. --default-module-for-created-files module-name Specifies the fallback target module for files created by annotation processors, if none is specified or inferred. -Djava.endorsed.dirs=dirs Overrides the location of the endorsed standards path. Note: This can only be used when compiling for releases prior to JDK 9. As applicable, see the descriptions in --release, -source, or -target for details. -Djava.ext.dirs=dirs Overrides the location of installed extensions. Note: This can only be used when compiling for releases prior to JDK 9. As applicable, see the descriptions in --release, -source, or -target for details. --patch-module module=path Overrides or augments a module with classes and resources in JAR files or directories. -Xbootclasspath:path Overrides the location of the bootstrap class files. Note: This can only be used when compiling for releases prior to JDK 9. As applicable, see the descriptions in --release, -source, or -target for details. -Xbootclasspath/a:path Adds a suffix to the bootstrap class path. Note: This can only be used when compiling for releases prior to JDK 9. As applicable, see the descriptions in --release, -source, or -target for details. -Xbootclasspath/p:path Adds a prefix to the bootstrap class path. Note: This can only be used when compiling for releases prior to JDK 9. As applicable, see the descriptions in --release, -source, or -target for details. -Xdiags:[compact, verbose] Selects a diagnostic mode. -Xdoclint Enables recommended checks for problems in documentation comments. -Xdoclint:(all|none|[-]group)[/access] Enables or disables specific groups of checks in documentation comments. group can have one of the following values: accessibility, html, missing, reference, syntax. The variable access specifies the minimum visibility level of classes and members that the -Xdoclint option checks. It can have one of the following values (in order of most to least visible): public, protected, package, private. The default access level is private. When prefixed by doclint:, the group names and all can be used with @SuppressWarnings to suppress warnings about documentation comments in parts of the code being compiled. For more information about these groups of checks, see the DocLint section of the javadoc command documentation. The -Xdoclint option is disabled by default in the javac command. For example, the following option checks classes and members (with all groups of checks) that have the access level of protected and higher (which includes protected and public): -Xdoclint:all/protected The following option enables all groups of checks for all access levels, except it will not check for HTML errors for classes and members that have the access level of package and higher (which includes package, protected and public): -Xdoclint:all,-html/package -Xdoclint/package:[-]packages(,[-]package)* Enables or disables checks in specific packages. Each package is either the qualified name of a package or a package name prefix followed by .*, which expands to all sub-packages of the given package. Each package can be prefixed with a hyphen (-) to disable checks for a specified package or packages. For more information, see the DocLint section of the javadoc command documentation. -Xlint Enables all recommended warnings. In this release, enabling all available warnings is recommended. -Xlint:[-]key(,[-]key)* Supplies warnings to enable or disable, separated by comma. Precede a key by a hyphen (-) to disable the specified warning. Supported values for key are: • all: Enables all warnings. • auxiliaryclass: Warns about an auxiliary class that is hidden in a source file, and is used from other files. • cast: Warns about the use of unnecessary casts. • classfile: Warns about the issues related to classfile contents. • deprecation: Warns about the use of deprecated items. • dep-ann: Warns about the items marked as deprecated in javadoc but without the @Deprecated annotation. • divzero: Warns about the division by the constant integer 0. • empty: Warns about an empty statement after if. • exports: Warns about the issues regarding module exports. • fallthrough: Warns about the falling through from one case of a switch statement to the next. • finally: Warns about finally clauses that do not terminate normally. • incubating: Warns about the use of incubating modules. • lossy-conversions: Warns about possible lossy conversions in compound assignment. • missing-explicit-ctor: Warns about missing explicit constructors in public and protected classes in exported packages. • module: Warns about the module system-related issues. • opens: Warns about the issues related to module opens. • options: Warns about the issues relating to use of command line options. • output-file-clash: Warns if any output file is overwritten during compilation. This can occur, for example, on case- insensitive filesystems. • overloads: Warns about the issues related to method overloads. • overrides: Warns about the issues related to method overrides. • path: Warns about the invalid path elements on the command line. • preview: Warns about the use of preview language features. • processing: Warns about the issues related to annotation processing. • rawtypes: Warns about the use of raw types. • removal: Warns about the use of an API that has been marked for removal. • restricted: Warns about the use of restricted methods. • requires-automatic: Warns developers about the use of automatic modules in requires clauses. • requires-transitive-automatic: Warns about automatic modules in requires transitive. • serial: Warns about the serializable classes that do not provide a serial version ID. Also warns about access to non- public members from a serializable element. • static: Warns about the accessing a static member using an instance. • strictfp: Warns about unnecessary use of the strictfp modifier. • synchronization: Warns about synchronization attempts on instances of value-based classes. • text-blocks: Warns about inconsistent white space characters in text block indentation. • this-escape: Warns about constructors leaking this prior to subclass initialization. • try: Warns about the issues relating to the use of try blocks (that is, try-with-resources). • unchecked: Warns about the unchecked operations. • varargs: Warns about the potentially unsafe vararg methods. • none: Disables all warnings. With the exception of all and none, the keys can be used with the @SuppressWarnings annotation to suppress warnings in a part of the source code being compiled. See Examples of Using -Xlint keys. -Xmaxerrs number Sets the maximum number of errors to print. -Xmaxwarns number Sets the maximum number of warnings to print. -Xpkginfo:[always, legacy, nonempty] Specifies when and how the javac command generates package-info.class files from package-info.java files using one of the following options: always Generates a package-info.class file for every package-info.java file. This option may be useful if you use a build system such as Ant, which checks that each .java file has a corresponding .class file. legacy Generates a package-info.class file only if package-info.java contains annotations. This option does not generate a package-info.class file if package-info.java contains only comments. Note: A package-info.class file might be generated but be empty if all the annotations in the package-info.java file have RetentionPolicy.SOURCE. nonempty Generates a package-info.class file only if package-info.java contains annotations with RetentionPolicy.CLASS or RetentionPolicy.RUNTIME. -Xplugin:name args Specifies the name and optional arguments for a plug-in to be run. If args are provided, name and args should be quoted or otherwise escape the whitespace characters between the name and all the arguments. For details on the API for a plugin, see the API documentation for jdk.compiler/com.sun.source.util.Plugin. -Xprefer:[source, newer] Specifies which file to read when both a source file and class file are found for an implicitly compiled class using one of the following options. See Searching for Module, Package and Type Declarations. • -Xprefer:newer: Reads the newer of the source or class files for a type (default). • -Xprefer:source : Reads the source file. Use -Xprefer:source when you want to be sure that any annotation processors can access annotations declared with a retention policy of SOURCE. -Xprint Prints a textual representation of specified types for debugging purposes. This does not perform annotation processing or compilation. The format of the output could change. -XprintProcessorInfo Prints information about which annotations a processor is asked to process. -XprintRounds Prints information about initial and subsequent annotation processing rounds. -Xstdout filename Sends compiler messages to the named file. By default, compiler messages go to System.err. ENVIRONMENT VARIABLES CLASSPATH If the --class-path option or any of its alternate forms are not specified, the class path will default to the value of the CLASSPATH environment variable if it is set. However, it is recommended that this environment variable should not be set, and that the --class-path option should be used to provide an explicit value for the class path when one is required. JDK_JAVAC_OPTIONS The content of the JDK_JAVAC_OPTIONS environment variable, separated by white-spaces ( ) or white-space characters (\n, \t, \r, or \f) is prepended to the command line arguments passed to javac as a list of arguments. The encoding requirement for the environment variable is the same as the javac command line on the system. JDK_JAVAC_OPTIONS environment variable content is treated in the same manner as that specified in the command line. Single quotes (') or double quotes (") can be used to enclose arguments that contain whitespace characters. All content between the open quote and the first matching close quote are preserved by simply removing the pair of quotes. In case a matching quote is not found, the launcher will abort with an error message. @files are supported as they are specified in the command line. However, as in @files, use of a wildcard is not supported. Examples of quoting arguments containing white spaces: export JDK_JAVAC_OPTIONS='@"C:\white spaces\argfile"' export JDK_JAVAC_OPTIONS='"@C:\white spaces\argfile"' export JDK_JAVAC_OPTIONS='@C:\"white spaces"\argfile' COMMAND-LINE ARGUMENT FILES An argument file can include command-line options and source file names in any combination. The arguments within a file can be separated by spaces or new line characters. If a file name contains embedded spaces, then put the whole file name in double quotation marks. File names within an argument file are relative to the current directory, not to the location of the argument file. Wildcards (*) are not allowed in these lists (such as for specifying *.java). Use of the at sign (@) to recursively interpret files is not supported. The -J options are not supported because they're passed to the launcher, which does not support argument files. When executing the javac command, pass in the path and name of each argument file with the at sign (@) leading character. When the javac command encounters an argument beginning with the at sign (@), it expands the contents of that file into the argument list. Examples of Using javac @filename Single Argument File You could use a single argument file named argfile to hold all javac arguments: javac @argfile This argument file could contain the contents of both files shown in the following Two Argument Files example. Two Argument Files You can create two argument files: one for the javac options and the other for the source file names. Note that the following lists have no line-continuation characters. Create a file named options that contains the following: Linux and macOS: -d classes -g -sourcepath /java/pubs/ws/1.3/src/share/classes Windows: -d classes -g -sourcepath C:\java\pubs\ws\1.3\src\share\classes Create a file named sources that contains the following: MyClass1.java MyClass2.java MyClass3.java Then, run the javac command as follows: javac @options @sources Argument Files with Paths The argument files can have paths, but any file names inside the files are relative to the current working directory (not path1 or path2): javac @path1/options @path2/sources ARRANGEMENT OF SOURCE CODE In the Java language, classes and interfaces can be organized into packages, and packages can be organized into modules. javac expects that the physical arrangement of source files in directories of the file system will mirror the organization of classes into packages, and packages into modules. It is a widely adopted convention that module names and package names begin with a lower-case letter, and that class names begin with an upper-case letter. Arrangement of Source Code for a Package When classes and interfaces are organized into a package, the package is represented as a directory, and any subpackages are represented as subdirectories. For example: • The package p is represented as a directory called p. • The package p.q -- that is, the subpackage q of package p -- is represented as the subdirectory q of directory p. The directory tree representing package p.q is therefore p\q on Windows, and p/q on other systems. • The package p.q.r is represented as the directory tree p\q\r (on Windows) or p/q/r (on other systems). Within a directory or subdirectory, .java files represent classes and interfaces in the corresponding package or subpackage. For example: • The class X declared in package p is represented by the file X.java in the p directory. • The class Y declared in package p.q is represented by the file Y.java in the q subdirectory of directory p. • The class Z declared in package p.q.r is represented by the file Z.java in the r subdirectory of p\q (on Windows) or p/q (on other systems). In some situations, it is convenient to split the code into separate directories, each structured as described above, and the aggregate list of directories specified to javac. Arrangement of Source Code for a Module In the Java language, a module is a set of packages designed for reuse. In addition to .java files for classes and interfaces, each module has a source file called module-info.java which: 1. declares the module's name; 2. lists the packages exported by the module (to allow reuse by other modules); 3. lists other modules required by the module (to reuse their exported packages). When packages are organized into a module, the module is represented by one or more directories representing the packages in the module, one of which contains the module-info.java file. It may be convenient, but it is not required, to use a single directory, named after the module, to contain the module-info.java file alongside the directory tree which represents the packages in the module (i.e., the package hierarchy described above). The exact arrangement of source code for a module is typically dictated by the conventions adopted by a development environment (IDE) or build system. For example: • The module a.b.c may be represented by the directory a.b.c, on all systems. • The module's declaration is represented by the file module-info.java in the a.b.c directory. • If the module contains package p.q.r, then the a.b.c directory contains the directory tree p\q\r (on Windows) or p/q/r (on other systems). The development environment may prescribe some directory hierarchy between the directory named for the module and the source files to be read by javac. For example: • The module a.b.c may be represented by the directory a.b.c • The module's declaration and the module's packages may be in some subdirectory of a.b.c, such as src\main\java (on Windows) or src/main/java (on other systems). CONFIGURING A COMPILATION This section describes how to configure javac to perform a basic compilation. See Configuring the Module System for additional details for use when compiling for a release of the platform that supports modules. Source Files • Specify the source files to be compiled on the command line. If there are no compilation errors, the corresponding class files will be placed in the output directory. Some systems may limit the amount you can put on a command line; to work around those limits, you can use argument files. When compiling code for modules, you can also specify source files indirectly, by using the --module or -m option. Output Directory • Use the -d option to specify an output directory in which to put the compiled class files. This will normally be organized in a package hierarchy, unless you are compiling source code from multiple modules, in which case it will be organized as a module hierarchy. When the compilation has been completed, if you are compiling one or more modules, you can place the output directory on the module path for the Java launcher; otherwise, you can place the place the output directory on the class path for the Java launcher. Precompiled Code The code to be compiled may refer to libraries beyond what is provided by the platform. If so, you must place these libraries on the class path or module path. If the library code is not in a module, place it on the class path; if it is in a module, place it on the module path. • Use the --class-path option to specify libraries to be placed on the class path. Locations on the class path should be organized in a package hierarchy. You can also use alternate forms of the option: -classpath or -cp. • Use the --module-path option to specify libraries to be placed on the module path. Locations on the module path should either be modules or directories of modules. You can also use an alternate form of the option: -p. See Configuring the Module System for details on how to modify the default configuration of library modules. Note: the options for the class path and module path are not mutually exclusive, although it is not common to specify the class path when compiling code for one or more modules. Additional Source Files The code to be compiled may refer to types in additional source files that are not specified on the command line. If so, you must put those source files on either the source path or module path. You can only specify one of these options: if you are not compiling code for a module, or if you are only compiling code for a single module, use the source path; if you are compiling code for multiple modules, use the module source path. • Use the --source-path option to specify the locations of additional source files that may be read by javac. Locations on the source path should be organized in a package hierarchy. You can also use an alternate form of the option: -sourcepath. • Use the --module-source-path option one or more times to specify the location of additional source files in different modules that may be read by javac, or when compiling source files in multiple modules. You can either specify the locations for each module individually, or you can organize the source files so that you can specify the locations all together. For more details, see The Module Source Path Option. If you want to be able to refer to types in additional source files but do not want them to be compiled, use the -implicit option. Note: if you are compiling code for multiple modules, you must always specify a module source path, and all source files specified on the command line must be in one of the directories on the module source path, or in a subdirectory thereof. Example of Compiling Multiple Source Files This example compiles the Aloha.java, GutenTag.java, Hello.java, and Hi.java source files in the greetings package. Linux and macOS: % javac greetings/*.java % ls greetings Aloha.class GutenTag.class Hello.class Hi.class Aloha.java GutenTag.java Hello.java Hi.java Windows: C:\>javac greetings\*.java C:\>dir greetings Aloha.class GutenTag.class Hello.class Hi.class Aloha.java GutenTag.java Hello.java Hi.java Example of Specifying a User Class Path After changing one of the source files in the previous example, recompile it: Linux and macOS: pwd /examples javac greetings/Hi.java Windows: C:\>cd \examples C:\>javac greetings\Hi.java Because greetings.Hi refers to other classes in the greetings package, the compiler needs to find these other classes. The previous example works because the default user class path is the directory that contains the package directory. If you want to recompile this file without concern for which directory you are in, then add the examples directory to the user class path by setting CLASSPATH. This example uses the -classpath option. Linux and macOS: javac -classpath /examples /examples/greetings/Hi.java Windows: C:\>javac -classpath \examples \examples\greetings\Hi.java If you change greetings.Hi to use a banner utility, then that utility also needs to be accessible through the user class path. Linux and macOS: javac -classpath /examples:/lib/Banners.jar \ /examples/greetings/Hi.java Windows: C:\>javac -classpath \examples;\lib\Banners.jar ^ \examples\greetings\Hi.java To execute a class in the greetings package, the program needs access to the greetings package, and to the classes that the greetings classes use. Linux and macOS: java -classpath /examples:/lib/Banners.jar greetings.Hi Windows: C:\>java -classpath \examples;\lib\Banners.jar greetings.Hi CONFIGURING THE MODULE SYSTEM If you want to include additional modules in your compilation, use the --add-modules option. This may be necessary when you are compiling code that is not in a module, or which is in an automatic module, and the code refers to API in the additional modules. If you want to restrict the set of modules in your compilation, use the --limit-modules option. This may be useful if you want to ensure that the code you are compiling is capable of running on a system with a limited set of modules installed. If you want to break encapsulation and specify that additional packages should be considered as exported from a module, use the --add-exports option. This may be useful when performing white-box testing; relying on access to internal API in production code is strongly discouraged. If you want to specify that additional packages should be considered as required by a module, use the --add-reads option. This may be useful when performing white-box testing; relying on access to internal API in production code is strongly discouraged. You can patch additional content into any module using the --patch-module option. See [Patching a Module] for more details. SEARCHING FOR MODULE, PACKAGE AND TYPE DECLARATIONS To compile a source file, the compiler often needs information about a module or type, but the declaration is not in the source files specified on the command line. javac needs type information for every class or interface used, extended, or implemented in the source file. This includes classes and interfaces not explicitly mentioned in the source file, but that provide information through inheritance. For example, when you create a subclass of java.awt.Window, you are also using the ancestor classes of Window: java.awt.Container, java.awt.Component, and java.lang.Object. When compiling code for a module, the compiler also needs to have available the declaration of that module. A successful search may produce a class file, a source file, or both. If both are found, then you can use the -Xprefer option to instruct the compiler which to use. If a search finds and uses a source file, then by default javac compiles that source file. This behavior can be altered with -implicit. The compiler might not discover the need for some type information until after annotation processing completes. When the type information is found in a source file and no -implicit option is specified, the compiler gives a warning that the file is being compiled without being subject to annotation processing. To disable the warning, either specify the file on the command line (so that it will be subject to annotation processing) or use the -implicit option to specify whether or not class files should be generated for such source files. The way that javac locates the declarations of those types depends on whether the reference exists within code for a module or not. Searching Package Oriented Paths When searching for a source or class file on a path composed of package oriented locations, javac will check each location on the path in turn for the possible presence of the file. The first occurrence of a particular file shadows (hides) any subsequent occurrences of like- named files. This shadowing does not affect any search for any files with a different name. This can be convenient when searching for source files, which may be grouped in different locations, such as shared code, platform-specific code and generated code. It can also be useful when injecting alternate versions of a class file into a package, to debugging or other instrumentation reasons. But, it can also be dangerous, such as when putting incompatible different versions of a library on the class path. Searching Module Oriented Paths Prior to scanning any module paths for any package or type declarations, javac will lazily scan the following paths and locations to determine the modules that will be used in the compilation. • The module source path (see the --module-source-path option) • The path for upgradeable modules (see the --upgrade-module-path option) • The system modules (see the --system option) • The user module path ( see the --module-path option) For any module, the first occurrence of the module during the scan completely shadows (hides) any subsequent appearance of a like-named module. While locating the modules, javac is able to determine the packages exported by the module and to associate with each module a package oriented path for the contents of the module. For any previously compiled module, this path will typically be a single entry for either a directory or a file that provides an internal directory- like hierarchy, such as a JAR file. Thus, when searching for a type that is in a package that is known to be exported by a module, javac can locate the declaration directly and efficiently. Searching for the Declaration of a Module If the module has been previously compiled, the module declaration is located in a file named module-info.class in the root of the package hierarchy for the content of the module. If the module is one of those currently being compiled, the module declaration will be either the file named module-info.class in the root of the package hierarchy for the module in the class output directory, or the file named module-info.java in one of the locations on the source path or one the module source path for the module. Searching for the Declaration of a Type When the Reference is not in a Module When searching for a type that is referenced in code that is not in a module, javac will look in the following places: • The platform classes (or the types in exported packages of the platform modules) (This is for compiled class files only.) • Types in exported packages of any modules on the module path, if applicable. (This is for compiled class files only.) • Types in packages on the class path and/or source path: • If both are specified, javac looks for compiled class files on the class path and for source files on the source path. • If the class path is specified, but not source path, javac looks for both compiled class files and source files on the class path. • If the class path is not specified, it defaults to the current directory. When looking for a type on the class path and/or source path, if both a compiled class file and a source file are found, the most recently modified file will be used by default. If the source file is newer, it will be compiled and will may override any previously compiled version of the file. You can use the -Xprefer option to override the default behavior. Searching for the Declaration of a Type When the Reference is in a Module When searching for a type that is referenced in code in a module, javac will examine the declaration of the enclosing module to determine if the type is in a package that is exported from another module that is readable by the enclosing module. If so, javac will simply and directly go to the definition of that module to find the definition of the required type. Unless the module is another of the modules being compiled, javac will only look for compiled class files files. In other words, javac will not look for source files in platform modules or modules on the module path. If the type being referenced is not in some other readable module, javac will examine the module being compiled to try and find the declaration of the type. javac will look for the declaration of the type as follows: • Source files specified on the command line or on the source path or module source path. • Previously compiled files in the output directory. DIRECTORY HIERARCHIES javac generally assumes that source files and compiled class files will be organized in a file system directory hierarchy or in a type of file that supports in an internal directory hierarchy, such as a JAR file. Three different kinds of hierarchy are supported: a package hierarchy, a module hierarchy, and a module source hierarchy. While javac is fairly relaxed about the organization of source code, beyond the expectation that source will be organized in one or package hierarchies, and can generally accommodate organizations prescribed by development environments and build tools, Java tools in general, and javac and the Java launcher in particular, are more stringent regarding the organization of compiled class files, and will be organized in package hierarchies or module hierarchies, as appropriate. The location of these hierarchies are specified to javac with command- line options, whose names typically end in "path", like --source-path or --class-path. Also as a general rule, path options whose name includes the word module, like --module-path, are used to specify module hierarchies, although some module-related path options allow a package hierarchy to be specified on a per-module basis. All other path options are used to specify package hierarchies. Package Hierarchy In a package hierarchy, directories and subdirectories are used to represent the component parts of the package name, with the source file or compiled class file for a type being stored as a file with an extension of .java or .class in the most nested directory. For example, in a package hierarchy, the source file for a class com.example.MyClass will be stored in the file com/example/MyClass.java Module Hierarchy In a module hierarchy, the first level of directories are named for the modules in the hierarchy; within each of those directories the contents of the module are organized in package hierarchies. For example, in a module hierarchy, the compiled class file for a type called com.example.MyClass in a module called my.library will be stored in my.library/com/example/MyClass.class. The various output directories used by javac (the class output directory, the source output directory, and native header output directory) will all be organized in a module hierarchy when multiple modules are being compiled. Module Source Hierarchy Although the source for each individual module should always be organized in a package hierarchy, it may be convenient to group those hierarchies into a module source hierarchy. This is similar to a module hierarchy, except that there may be intervening directories between the directory for the module and the directory that is the root of the package hierarchy for the source code of the module. For example, in a module source hierarchy, the source file for a type called com.example.MyClass in a module called my.library may be stored in a file such as my.library/src/main/java/com/example/MyClass.java. THE MODULE SOURCE PATH OPTION The --module-source-path option has two forms: a module-specific form, in which a package path is given for each module containing code to be compiled, and a module-pattern form, in which the source path for each module is specified by a pattern. The module-specific form is generally simpler to use when only a small number of modules are involved; the module-pattern form may be more convenient when the number of modules is large and the modules are organized in a regular manner that can be described by a pattern. Multiple instances of the --module-source-path option may be given, each one using either the module-pattern form or the module-specific form, subject to the following limitations: • the module-pattern form may be used at most once • the module-specific form may be used at most once for any given module If the module-specific form is used for any module, the associated search path overrides any path that might otherwise have been inferred from the module-pattern form. Module-specific form The module-specific form allows an explicit search path to be given for any specific module. This form is: • --module-source-path module-name=file-path (path-separator file- path)* The path separator character is ; on Windows, and : otherwise. Note: this is similar to the form used for the --patch-module option. Module-pattern form The module-pattern form allows a concise specification of the module source path for any number of modules organized in regular manner. • --module-source-path pattern The pattern is defined by the following rules, which are applied in order: • The argument is considered to be a series of segments separated by the path separator character (; on Windows, and : otherwise). • Each segment containing curly braces of the form string1{alt1 ( ,alt2 )* } string2 is considered to be replaced by a series of segments formed by "expanding" the braces: string1 alt1 string2 string1 alt2 string2 and so on... The braces may be nested. This rule is applied for all such usages of braces. • Each segment must have at most one asterisk (*). If a segment does not contain an asterisk, it is considered to be as though the file separator character and an asterisk are appended. For any module M, the source path for that module is formed from the series of segments obtained by substituting the module name M for the asterisk in each segment. Note: in this context, the asterisk is just used as a special marker, to denote the position in the path of the module name. It should not be confused with the use of * as a file name wildcard character, as found on most operating systems. PATCHING MODULES javac allows any content, whether in source or compiled form, to be patched into any module using the --patch-module option. You may want to do this to compile alternative implementations of a class to be patched at runtime into a JVM, or to inject additional classes into the module, such as when testing. The form of the option is: • --patch-module module-name=file-path (path-separator file-path )* The path separator character is ; on Windows, and : otherwise. The paths given for the module must specify the root of a package hierarchy for the contents of the module The option may be given at most once for any given module. Any content on the path will hide any like-named content later in the path and in the patched module. When patching source code into more than one module, the --module-source-path must also be used, so that the output directory is organized in a module hierarchy, and capable of holding the compiled class files for the modules being compiled. ANNOTATION PROCESSING The javac command provides direct support for annotation processing. The API for annotation processors is defined in the javax.annotation.processing and javax.lang.model packages and subpackages. How Annotation Processing Works Unless annotation processing is disabled with the -proc:none option, the compiler searches for any annotation processors that are available. The search path can be specified with the -processorpath option. If no path is specified, then the user class path is used. Processors are located by means of service provider-configuration files named META-INF/services/javax.annotation.processing.Processor on the search path. Such files should contain the names of any annotation processors to be used, listed one per line. Alternatively, processors can be specified explicitly, using the -processor option. After scanning the source files and classes on the command line to determine what annotations are present, the compiler queries the processors to determine what annotations they process. When a match is found, the processor is called. A processor can claim the annotations it processes, in which case no further attempt is made to find any processors for those annotations. After all of the annotations are claimed, the compiler does not search for additional processors. If any processors generate new source files, then another round of annotation processing occurs: Any newly generated source files are scanned, and the annotations processed as before. Any processors called on previous rounds are also called on all subsequent rounds. This continues until no new source files are generated. After a round occurs where no new source files are generated, the annotation processors are called one last time, to give them a chance to complete any remaining work. Finally, unless the -proc:only option is used, the compiler compiles the original and all generated source files. If you use an annotation processor that generates additional source files to be included in the compilation, you can specify a default module to be used for the newly generated files, for use when a module declaration is not also generated. In this case, use the --default-module-for-created-files option. Compilation Environment and Runtime Environment. The declarations in source files and previously compiled class files are analyzed by javac in a compilation environment that is distinct from the runtime environment used to execute javac itself. Although there is a deliberate similarity between many javac options and like- named options for the Java launcher, such as --class-path, --module-path and so on, it is important to understand that in general the javac options just affect the environment in which the source files are compiled, and do not affect the operation of javac itself. The distinction between the compilation environment and runtime environment is significant when it comes to using annotation processors. Although annotations processors process elements (declarations) that exist in the compilation environment, the annotation processor itself is executed in the runtime environment. If an annotation processor has dependencies on libraries that are not in modules, the libraries can be placed, along with the annotation processor itself, on the processor path. (See the --processor-path option.) If the annotation processor and its dependencies are in modules, you should use the processor module path instead. (See the --processor-module-path option.) When those are insufficient, it may be necessary to provide further configuration of the runtime environment. This can be done in two ways: 1. If javac is invoked from the command line, options can be passed to the underlying runtime by prefixing the option with -J. 2. You can start an instance of a Java Virtual Machine directly and use command line options and API to configure an environment in which javac can be invoked via one of its APIs. COMPILING FOR EARLIER RELEASES OF THE PLATFORM javac can compile code that is to be used on other releases of the platform, using either the --release option, or the --source/-source and --target/-target options, together with additional options to specify the platform classes. Depending on the desired platform release, there are some restrictions on some of the options that can be used. • When compiling for JDK 8 and earlier releases, you cannot use any option that is intended for use with the module system. This includes all of the following options: • --module-source-path, --upgrade-module-path, --system, --module-path, --add-modules, --add-exports, --add-opens, --add-reads, --limit-modules, --patch-module If you use the --source/-source or --target/-target options, you should also set the appropriate platform classes using the boot class path family of options. • When compiling for JDK 9 and later releases, you cannot use any option that is intended to configure the boot class path. This includes all of the following options: • -Xbootclasspath/p:, -Xbootclasspath, -Xbootclasspath/a:, -endorseddirs, -Djava.endorsed.dirs, -extdirs, -Djava.ext.dirs, -profile If you use the --source/-source or --target/-target options, you should also set the appropriate platform classes using the --system option to give the location of an appropriate installed release of JDK. When using the --release option, only the supported documented API for that release may be used; you cannot use any options to break encapsulation to access any internal classes. APIS The javac compiler can be invoked using an API in three different ways: The Java Compiler API This provides the most flexible way to invoke the compiler, including the ability to compile source files provided in memory buffers or other non-standard file systems. The ToolProvider API A ToolProvider for javac can be obtained by calling ToolProvider.findFirst("javac"). This returns an object with the equivalent functionality of the command-line tool. Note: This API should not be confused with the like-named API in the javax.tools package. The javac Legacy API This API is retained for backward compatibility only. All new code should use either the Java Compiler API or the ToolProvider API. Note: All other classes and methods found in a package with names that start with com.sun.tools.javac (subpackages of com.sun.tools.javac) are strictly internal and subject to change at any time. EXAMPLES OF USING -XLINT KEYS cast Warns about unnecessary and redundant casts, for example: String s = (String) "Hello!" classfile Warns about issues related to class file contents. deprecation Warns about the use of deprecated items. For example: java.util.Date myDate = new java.util.Date(); int currentDay = myDate.getDay(); The method java.util.Date.getDay has been deprecated since JDK 1.1. dep-ann Warns about items that are documented with the @deprecated Javadoc comment, but do not have the @Deprecated annotation, for example: /** * @deprecated As of Java SE 7, replaced by {@link #newMethod()} */ public static void deprecatedMethod() { } public static void newMethod() { } divzero Warns about division by the constant integer 0, for example: int divideByZero = 42 / 0; empty Warns about empty statements after ifstatements, for example: class E { void m() { if (true) ; } } fallthrough Checks the switch blocks for fall-through cases and provides a warning message for any that are found. Fall-through cases are cases in a switch block, other than the last case in the block, whose code does not include a break statement, allowing code execution to fall through from that case to the next case. For example, the code following the case 1 label in this switch block does not end with a break statement: switch (x) { case 1: System.out.println("1"); // No break statement here. case 2: System.out.println("2"); } If the -Xlint:fallthrough option was used when compiling this code, then the compiler emits a warning about possible fall- through into case, with the line number of the case in question. finally Warns about finally clauses that cannot be completed normally, for example: public static int m() { try { throw new NullPointerException(); } catch (NullPointerException(); { System.err.println("Caught NullPointerException."); return 1; } finally { return 0; } } The compiler generates a warning for the finally block in this example. When the int method is called, it returns a value of 0. A finally block executes when the try block exits. In this example, when control is transferred to the catch block, the int method exits. However, the finally block must execute, so it's executed, even though control was transferred outside the method. Warns about issues that related to the use of command-line options. See Compiling for Earlier Releases of the Platform. overrides Warns about issues related to method overrides. For example, consider the following two classes: public class ClassWithVarargsMethod { void varargsMethod(String... s) { } } public class ClassWithOverridingMethod extends ClassWithVarargsMethod { @Override void varargsMethod(String[] s) { } } The compiler generates a warning similar to the following:. warning: [override] varargsMethod(String[]) in ClassWithOverridingMethod overrides varargsMethod(String...) in ClassWithVarargsMethod; overriding method is missing '...' When the compiler encounters a varargs method, it translates the varargs formal parameter into an array. In the method ClassWithVarargsMethod.varargsMethod, the compiler translates the varargs formal parameter String... s to the formal parameter String[] s, an array that matches the formal parameter of the method ClassWithOverridingMethod.varargsMethod. Consequently, this example compiles. path Warns about invalid path elements and nonexistent path directories on the command line (with regard to the class path, the source path, and other paths). Such warnings cannot be suppressed with the @SuppressWarnings annotation. For example: • Linux and macOS: javac -Xlint:path -classpath /nonexistentpath Example.java • Windows: javac -Xlint:path -classpath C:\nonexistentpath Example.java processing Warns about issues related to annotation processing. The compiler generates this warning when you have a class that has an annotation, and you use an annotation processor that cannot handle that type of annotation. For example, the following is a simple annotation processor: Source file AnnoProc.java: import java.util.*; import javax.annotation.processing.*; import javax.lang.model.*; import javax.lang.model.element.*; @SupportedAnnotationTypes("NotAnno") public class AnnoProc extends AbstractProcessor { public boolean process(Set<? extends TypeElement> elems, RoundEnvironment renv){ return true; } public SourceVersion getSupportedSourceVersion() { return SourceVersion.latest(); } } Source file AnnosWithoutProcessors.java: @interface Anno { } @Anno class AnnosWithoutProcessors { } The following commands compile the annotation processor AnnoProc, then run this annotation processor against the source file AnnosWithoutProcessors.java: javac AnnoProc.java javac -cp . -Xlint:processing -processor AnnoProc -proc:only AnnosWithoutProcessors.java When the compiler runs the annotation processor against the source file AnnosWithoutProcessors.java, it generates the following warning: warning: [processing] No processor claimed any of these annotations: Anno To resolve this issue, you can rename the annotation defined and used in the class AnnosWithoutProcessors from Anno to NotAnno. rawtypes Warns about unchecked operations on raw types. The following statement generates a rawtypes warning: void countElements(List l) { ... } The following example does not generate a rawtypes warning: void countElements(List<?> l) { ... } List is a raw type. However, List<?> is an unbounded wildcard parameterized type. Because List is a parameterized interface, always specify its type argument. In this example, the List formal argument is specified with an unbounded wildcard (?) as its formal type parameter, which means that the countElements method can accept any instantiation of the List interface. serial Warns about missing serialVersionUID definitions on serializable classes. For example: public class PersistentTime implements Serializable { private Date time; public PersistentTime() { time = Calendar.getInstance().getTime(); } public Date getTime() { return time; } } The compiler generates the following warning: warning: [serial] serializable class PersistentTime has no definition of serialVersionUID If a serializable class does not explicitly declare a field named serialVersionUID, then the serialization runtime environment calculates a default serialVersionUID value for that class based on various aspects of the class, as described in the Java Object Serialization Specification. However, it's strongly recommended that all serializable classes explicitly declare serialVersionUID values because the default process of computing serialVersionUID values is highly sensitive to class details that can vary depending on compiler implementations. As a result, this might cause an unexpected InvalidClassExceptions during deserialization. To guarantee a consistent serialVersionUID value across different Java compiler implementations, a serializable class must declare an explicit serialVersionUID value. static Warns about issues relating to the use of static variables, for example: class XLintStatic { static void m1() { } void m2() { this.m1(); } } The compiler generates the following warning: warning: [static] static method should be qualified by type name, XLintStatic, instead of by an expression To resolve this issue, you can call the static method m1 as follows: XLintStatic.m1(); Alternately, you can remove the static keyword from the declaration of the method m1. this-escape Warns about constructors leaking this prior to subclass initialization. For example, this class: public class MyClass { public MyClass() { System.out.println(this.hashCode()); } } generates the following warning: MyClass.java:3: warning: [this-escape] possible 'this' escape before subclass is fully initialized System.out.println(this.hashCode()); ^ A 'this' escape warning is generated when a constructor does something that might result in a subclass method being invoked before the constructor returns. In such cases the subclass method would be operating on an incompletely initialized instance. In the above example, a subclass of MyClass that overrides hashCode() to incorporate its own fields would likely produce an incorrect result when invoked as shown. Warnings are only generated if a subclass could exist that is outside of the current module (or package, if no module) being compiled. So, for example, constructors in final and non-public classes do not generate warnings. try Warns about issues relating to the use of try blocks, including try-with-resources statements. For example, a warning is generated for the following statement because the resource ac declared in the try block is not used: try ( AutoCloseable ac = getResource() ) { // do nothing} unchecked Gives more detail for unchecked conversion warnings that are mandated by the Java Language Specification, for example: List l = new ArrayList<Number>(); List<String> ls = l; // unchecked warning During type erasure, the types ArrayList<Number> and List<String> become ArrayList and List, respectively. The ls command has the parameterized type List<String>. When the List referenced by l is assigned to ls, the compiler generates an unchecked warning. At compile time, the compiler and JVM cannot determine whether l refers to a List<String> type. In this case, l does not refer to a List<String> type. As a result, heap pollution occurs. A heap pollution situation occurs when the List object l, whose static type is List<Number>, is assigned to another List object, ls, that has a different static type, List<String>. However, the compiler still allows this assignment. It must allow this assignment to preserve backward compatibility with releases of Java SE that do not support generics. Because of type erasure, List<Number> and List<String> both become List. Consequently, the compiler allows the assignment of the object l, which has a raw type of List, to the object ls. varargs Warns about unsafe use of variable arguments (varargs) methods, in particular, those that contain non-reifiable arguments, for example: public class ArrayBuilder { public static <T> void addToList (List<T> listArg, T... elements) { for (T x : elements) { listArg.add(x); } } } A non-reifiable type is a type whose type information is not fully available at runtime. The compiler generates the following warning for the definition of the method ArrayBuilder.addToList: warning: [varargs] Possible heap pollution from parameterized vararg type T When the compiler encounters a varargs method, it translates the varargs formal parameter into an array. However, the Java programming language does not permit the creation of arrays of parameterized types. In the method ArrayBuilder.addToList, the compiler translates the varargs formal parameter T... elements to the formal parameter T[] elements, an array. However, because of type erasure, the compiler converts the varargs formal parameter to Object[] elements. Consequently, there's a possibility of heap pollution. JDK 22 2024 JAVAC(1)
null
keytool
The keytool command is a key and certificate management utility. It enables users to administer their own public/private key pairs and associated certificates for use in self-authentication (where a user authenticates themselves to other users and services) or data integrity and authentication services, by using digital signatures. The keytool command also enables users to cache the public keys (in the form of certificates) of their communicating peers. A certificate is a digitally signed statement from one entity (person, company, and so on), which says that the public key (and some other information) of some other entity has a particular value. When data is digitally signed, the signature can be verified to check the data integrity and authenticity. Integrity means that the data hasn't been modified or tampered with, and authenticity means that the data comes from the individual who claims to have created and signed it. The keytool command also enables users to administer secret keys and passphrases used in symmetric encryption and decryption (Data Encryption Standard). It can also display other security-related information. The keytool command stores the keys and certificates in a keystore. The keytool command uses the jdk.certpath.disabledAlgorithms and jdk.security.legacyAlgorithms security properties to determine which algorithms are considered a security risk. It emits warnings when disabled or legacy algorithms are being used. The jdk.certpath.disabledAlgorithms and jdk.security.legacyAlgorithms security properties are defined in the java.security file (located in the JDK's $JAVA_HOME/conf/security directory). COMMAND AND OPTION NOTES The following notes apply to the descriptions in Commands and Options: • All command and option names are preceded by a hyphen sign (-). • Only one command can be provided. • Options for each command can be provided in any order. • There are two kinds of options, one is single-valued which should be only provided once. If a single-valued option is provided multiple times, the value of the last one is used. The other type is multi- valued, which can be provided multiple times and all values are used. The only multi-valued option currently supported is the -ext option used to generate X.509v3 certificate extensions. • All items not italicized or in braces ({ }) or brackets ([ ]) are required to appear as is. • Braces surrounding an option signify that a default value is used when the option isn't specified on the command line. Braces are also used around the -v, -rfc, and -J options, which have meaning only when they appear on the command line. They don't have any default values. • Brackets surrounding an option signify that the user is prompted for the values when the option isn't specified on the command line. For the -keypass option, if you don't specify the option on the command line, then the keytool command first attempts to use the keystore password to recover the private/secret key. If this attempt fails, then the keytool command prompts you for the private/secret key password. • Items in italics (option values) represent the actual values that must be supplied. For example, here is the format of the -printcert command: keytool -printcert {-file cert_file} {-v} When you specify a -printcert command, replace cert_file with the actual file name, as follows: keytool -printcert -file VScert.cer • Option values must be enclosed in quotation marks when they contain a blank (space). COMMANDS AND OPTIONS The keytool commands and their options can be grouped by the tasks that they perform. Commands for Creating or Adding Data to the Keystore: • -gencert • -genkeypair • -genseckey • -importcert • -importpass Commands for Importing Contents from Another Keystore: • -importkeystore Commands for Generating a Certificate Request: • -certreq Commands for Exporting Data: • -exportcert Commands for Displaying Data: • -list • -printcert • -printcertreq • -printcrl Commands for Managing the Keystore: • -storepasswd • -keypasswd • -delete • -changealias Commands for Displaying Security-related Information: • -showinfo Commands for Displaying Program Version: • -version COMMANDS FOR CREATING OR ADDING DATA TO THE KEYSTORE -gencert The following are the available options for the -gencert command: • {-rfc}: Output in RFC (Request For Comment) style • {-infile infile}: Input file name • {-outfile outfile}: Output file name • {-alias alias}: Alias name of the entry to process • {-sigalg sigalg}: Signature algorithm name • {-dname dname}: Distinguished name • {-startdate startdate}: Certificate validity start date and time • {-ext ext}*: X.509 extension • {-validity days}: Validity number of days • [-keypass arg]: Key password • {-keystore keystore}: Keystore name • [-storepass arg]: Keystore password • {-storetype type}: Keystore type • {-providername name}: Provider name • {-addprovider name [-providerarg arg]}: Adds a security provider by name (such as SunPKCS11) with an optional configure argument. The value of the security provider is the name of a security provider that is defined in a module. For example, keytool -addprovider SunPKCS11 -providerarg some.cfg ... Note: For compatibility reasons, the SunPKCS11 provider can still be loaded with -providerclass sun.security.pkcs11.SunPKCS11 even if it is now defined in a module. This is the only module included in the JDK that needs a configuration, and therefore the most widely used with the -providerclass option. For legacy security providers located on classpath and loaded by reflection, -providerclass should still be used. • {-providerclass class [-providerarg arg]}: Add security provider by fully qualified class name with an optional configure argument. For example, if MyProvider is a legacy provider loaded via reflection, keytool -providerclass com.example.MyProvider ... • {-providerpath list}: Provider classpath • {-v}: Verbose output • {-protected}: Password provided through a protected mechanism Use the -gencert command to generate a certificate as a response to a certificate request file (which can be created by the keytool -certreq command). The command reads the request either from infile or, if omitted, from the standard input, signs it by using the alias's private key, and outputs the X.509 certificate into either outfile or, if omitted, to the standard output. When -rfc is specified, the output format is Base64-encoded PEM; otherwise, a binary DER is created. The -sigalg value specifies the algorithm that should be used to sign the certificate. The startdate argument is the start time and date that the certificate is valid. The days argument tells the number of days for which the certificate should be considered valid. When dname is provided, it is used as the subject of the generated certificate. Otherwise, the one from the certificate request is used. The -ext value shows what X.509 extensions will be embedded in the certificate. Read Common Command Options for the grammar of -ext. The -gencert option enables you to create certificate chains. The following example creates a certificate, e1, that contains three certificates in its certificate chain. The following commands creates four key pairs named ca, ca1, ca2, and e1: keytool -alias ca -dname CN=CA -genkeypair -keyalg rsa keytool -alias ca1 -dname CN=CA -genkeypair -keyalg rsa keytool -alias ca2 -dname CN=CA -genkeypair -keyalg rsa keytool -alias e1 -dname CN=E1 -genkeypair -keyalg rsa The following two commands create a chain of signed certificates; ca signs ca1 and ca1 signs ca2, all of which are self-issued: keytool -alias ca1 -certreq | keytool -alias ca -gencert -ext san=dns:ca1 | keytool -alias ca1 -importcert keytool -alias ca2 -certreq | keytool -alias ca1 -gencert -ext san=dns:ca2 | keytool -alias ca2 -importcert The following command creates the certificate e1 and stores it in the e1.cert file, which is signed by ca2. As a result, e1 should contain ca, ca1, and ca2 in its certificate chain: keytool -alias e1 -certreq | keytool -alias ca2 -gencert > e1.cert -genkeypair The following are the available options for the -genkeypair command: • {-alias alias}: Alias name of the entry to process • -keyalg alg: Key algorithm name • {-keysize size}: Key bit size • {-groupname name}: Group name. For example, an Elliptic Curve name. • {-sigalg alg}: Signature algorithm name • {-signer alias}: Signer alias • [-signerkeypass arg]: Signer key password • [-dname name]: Distinguished name • {-startdate date}: Certificate validity start date and time • {-ext value}*: X.509 extension • {-validity days}: Validity number of days • [-keypass arg]: Key password • {-keystore keystore}: Keystore name • [-storepass arg]: Keystore password • {-storetype type}: Keystore type • {-providername name}: Provider name • {-addprovider name [-providerarg arg]}: Add security provider by name (such as SunPKCS11) with an optional configure argument. • {-providerclass class [-providerarg arg] }: Add security provider by fully qualified class name with an optional configure argument. • {-providerpath list}: Provider classpath • {-v}: Verbose output • {-protected}: Password provided through a protected mechanism Use the -genkeypair command to generate a key pair (a public key and associated private key). When the -signer option is not specified, the public key is wrapped in an X.509 v3 self-signed certificate and stored as a single-element certificate chain. When the -signer option is specified, a new certificate is generated and signed by the designated signer and stored as a multiple-element certificate chain (containing the generated certificate itself, and the signer's certificate chain). The certificate chain and private key are stored in a new keystore entry that is identified by its alias. The -keyalg value specifies the algorithm to be used to generate the key pair. The -keysize value specifies the size of each key to be generated. The -groupname value specifies the named group (for example, the standard or predefined name of an Elliptic Curve) of the key to be generated. When a -keysize value is provided, it will be used to initialize a KeyPairGenerator object using the initialize(int keysize) method. When a -groupname value is provided, it will be used to initialize a KeyPairGenerator object using the initialize(AlgorithmParameterSpec params) method where params is new NamedParameterSpec(groupname). Only one of -groupname and -keysize can be specified. If an algorithm has multiple named groups that have the same key size, the -groupname option should usually be used. In this case, if -keysize is specified, it's up to the security provider to determine which named group is chosen when generating a key pair. The -sigalg value specifies the algorithm that should be used to sign the certificate. This algorithm must be compatible with the -keyalg value. The -signer value specifies the alias of a PrivateKeyEntry for the signer that already exists in the keystore. This option is used to sign the certificate with the signer's private key. This is especially useful for key agreement algorithms (i.e. the -keyalg value is XDH, X25519, X448, or DH) as these keys cannot be used for digital signatures, and therefore a self- signed certificate cannot be created. The -signerkeypass value specifies the password of the signer's private key. It can be specified if the private key of the signer entry is protected by a password different from the store password. The -dname value specifies the X.500 Distinguished Name to be associated with the value of -alias. If the -signer option is not specified, the issuer and subject fields of the self-signed certificate are populated with the specified distinguished name. If the -signer option is specified, the subject field of the certificate is populated with the specified distinguished name and the issuer field is populated with the subject field of the signer's certificate. If a distinguished name is not provided at the command line, then the user is prompted for one. The value of -keypass is a password used to protect the private key of the generated key pair. If a password is not provided, then the user is prompted for it. If you press the Return key at the prompt, then the key password is set to the same password as the keystore password. The -keypass value must have at least six characters. The value of -startdate specifies the issue time of the certificate, also known as the "Not Before" value of the X.509 certificate's Validity field. The option value can be set in one of these two forms: ([+-]nnn[ymdHMS])+ [yyyy/mm/dd] [HH:MM:SS] With the first form, the issue time is shifted by the specified value from the current time. The value is a concatenation of a sequence of subvalues. Inside each subvalue, the plus sign (+) means shift forward, and the minus sign (-) means shift backward. The time to be shifted is nnn units of years, months, days, hours, minutes, or seconds (denoted by a single character of y, m, d, H, M, or S respectively). The exact value of the issue time is calculated by using the java.util.GregorianCalendar.add(int field, int amount) method on each subvalue, from left to right. For example, the issue time can be specified by: Calendar c = new GregorianCalendar(); c.add(Calendar.YEAR, -1); c.add(Calendar.MONTH, 1); c.add(Calendar.DATE, -1); return c.getTime() With the second form, the user sets the exact issue time in two parts, year/month/day and hour:minute:second (using the local time zone). The user can provide only one part, which means the other part is the same as the current date (or time). The user must provide the exact number of digits shown in the format definition (padding with 0 when shorter). When both date and time are provided, there is one (and only one) space character between the two parts. The hour should always be provided in 24-hour format. When the option isn't provided, the start date is the current time. The option can only be provided one time. The value of date specifies the number of days (starting at the date specified by -startdate, or the current date when -startdate isn't specified) for which the certificate should be considered valid. -genseckey The following are the available options for the -genseckey command: • {-alias alias}: Alias name of the entry to process • [-keypass arg]: Key password • -keyalg alg: Key algorithm name • {-keysize size}: Key bit size • {-keystore keystore}: Keystore name • [-storepass arg]: Keystore password • {-storetype type}: Keystore type • {-providername name}: Provider name • {-addprovider name [-providerarg arg]}: Add security provider by name (such as SunPKCS11) with an optional configure argument. • {-providerclass class [-providerarg arg]}: Add security provider by fully qualified class name with an optional configure argument. • {-providerpath list}: Provider classpath • {-v}: Verbose output • {-protected}: Password provided through a protected mechanism Use the -genseckey command to generate a secret key and store it in a new KeyStore.SecretKeyEntry identified by alias. The value of -keyalg specifies the algorithm to be used to generate the secret key, and the value of -keysize specifies the size of the key that is generated. The -keypass value is a password that protects the secret key. If a password is not provided, then the user is prompted for it. If you press the Return key at the prompt, then the key password is set to the same password that is used for the -keystore. The -keypass value must contain at least six characters. -importcert The following are the available options for the -importcert command: • {-noprompt}: Do not prompt • {-trustcacerts}: Trust certificates from cacerts • {-protected}: Password is provided through protected mechanism • {-alias alias}: Alias name of the entry to process • {-file file}: Input file name • [-keypass arg]: Key password • {-keystore keystore}: Keystore name • {-cacerts}: Access the cacerts keystore • [-storepass arg]: Keystore password • {-storetype type}: Keystore type • {-providername name}: Provider name • {-addprovider name [-providerarg arg]}: Add security provider by name (such as SunPKCS11) with an optional configure argument. • {-providerclass class [-providerarg arg]}: Add security provider by fully qualified class name with an optional configure argument. • {-providerpath list}: Provider classpath • {-v}: Verbose output Use the -importcert command to read the certificate or certificate chain (where the latter is supplied in a PKCS#7 formatted reply or in a sequence of X.509 certificates) from -file file, and store it in the keystore entry identified by -alias. If -file file is not specified, then the certificate or certificate chain is read from stdin. The keytool command can import X.509 v1, v2, and v3 certificates, and PKCS#7 formatted certificate chains consisting of certificates of that type. The data to be imported must be provided either in binary encoding format or in printable encoding format (also known as Base64 encoding) as defined by the Internet RFC 1421 standard. In the latter case, the encoding must be bounded at the beginning by a string that starts with -----BEGIN, and bounded at the end by a string that starts with -----END. You import a certificate for two reasons: To add it to the list of trusted certificates, and to import a certificate reply received from a certificate authority (CA) as the result of submitting a Certificate Signing Request (CSR) to that CA. See the -certreq command in Commands for Generating a Certificate Request. The type of import is indicated by the value of the -alias option. If the alias doesn't point to a key entry, then the keytool command assumes you are adding a trusted certificate entry. In this case, the alias shouldn't already exist in the keystore. If the alias does exist, then the keytool command outputs an error because a trusted certificate already exists for that alias, and doesn't import the certificate. If -alias points to a key entry, then the keytool command assumes that you're importing a certificate reply. -importpass The following are the available options for the -importpass command: • {-alias alias}: Alias name of the entry to process • [-keypass arg]: Key password • {-keyalg alg}: Key algorithm name • {-keysize size}: Key bit size • {-keystore keystore}: Keystore name • [-storepass arg]: Keystore password • {-storetype type}: Keystore type • {-providername name}: Provider name • {-addprovider name [-providerarg arg]}: Add security provider by name (such as SunPKCS11) with an optional configure argument. • {-providerclass class [-providerarg arg]}: Add security provider by fully qualified class name with an optional configure argument. • {-providerpath list}: Provider classpath • {-v}: Verbose output • {-protected}: Password provided through a protected mechanism Use the -importpass command to imports a passphrase and store it in a new KeyStore.SecretKeyEntry identified by -alias. The passphrase may be supplied via the standard input stream; otherwise the user is prompted for it. The -keypass option provides a password to protect the imported passphrase. If a password is not provided, then the user is prompted for it. If you press the Return key at the prompt, then the key password is set to the same password as that used for the keystore. The -keypass value must contain at least six characters. COMMANDS FOR IMPORTING CONTENTS FROM ANOTHER KEYSTORE -importkeystore The following are the available options for the -importkeystore command: • -srckeystore keystore: Source keystore name • {-destkeystore keystore}: Destination keystore name • {-srcstoretype type}: Source keystore type • {-deststoretype type}: Destination keystore type • [-srcstorepass arg]: Source keystore password • [-deststorepass arg]: Destination keystore password • {-srcprotected}: Source keystore password protected • {-destprotected}: Destination keystore password protected • {-srcprovidername name}: Source keystore provider name • {-destprovidername name}: Destination keystore provider name • {-srcalias alias}: Source alias • {-destalias alias}: Destination alias • [-srckeypass arg]: Source key password • [-destkeypass arg]: Destination key password • {-noprompt}: Do not prompt • {-addprovider name [-providerarg arg]: Add security provider by name (such as SunPKCS11) with an optional configure argument. • {-providerclass class [-providerarg arg]}: Add security provider by fully qualified class name with an optional configure argument • {-providerpath list}: Provider classpath • {-v}: Verbose output Note: This is the first line of all options: -srckeystore keystore -destkeystore keystore Use the -importkeystore command to import a single entry or all entries from a source keystore to a destination keystore. Note: If you do not specify -destkeystore when using the keytool -importkeystore command, then the default keystore used is $HOME/.keystore. When the -srcalias option is provided, the command imports the single entry identified by the alias to the destination keystore. If a destination alias isn't provided with -destalias, then -srcalias is used as the destination alias. If the source entry is protected by a password, then -srckeypass is used to recover the entry. If -srckeypass isn't provided, then the keytool command attempts to use -srcstorepass to recover the entry. If -srcstorepass is not provided or is incorrect, then the user is prompted for a password. The destination entry is protected with -destkeypass. If -destkeypass isn't provided, then the destination entry is protected with the source entry password. For example, most third-party tools require storepass and keypass in a PKCS #12 keystore to be the same. To create a PKCS#12 keystore for these tools, always specify a -destkeypass that is the same as -deststorepass. If the -srcalias option isn't provided, then all entries in the source keystore are imported into the destination keystore. Each destination entry is stored under the alias from the source entry. If the source entry is protected by a password, then -srcstorepass is used to recover the entry. If -srcstorepass is not provided or is incorrect, then the user is prompted for a password. If a source keystore entry type isn't supported in the destination keystore, or if an error occurs while storing an entry into the destination keystore, then the user is prompted either to skip the entry and continue or to quit. The destination entry is protected with the source entry password. If the destination alias already exists in the destination keystore, then the user is prompted either to overwrite the entry or to create a new entry under a different alias name. If the -noprompt option is provided, then the user isn't prompted for a new destination alias. Existing entries are overwritten with the destination alias name. Entries that can't be imported are skipped and a warning is displayed. COMMANDS FOR GENERATING A CERTIFICATE REQUEST -certreq The following are the available options for the -certreq command: • {-alias alias}: Alias name of the entry to process • {-sigalg alg}: Signature algorithm name • {-file file}: Output file name • [ -keypass arg]: Key password • {-keystore keystore}: Keystore name • {-dname name}: Distinguished name • {-ext value}: X.509 extension • [-storepass arg]: Keystore password • {-storetype type}: Keystore type • {-providername name}: Provider name • {-addprovider name [-providerarg arg]}: Add security provider by name (such as SunPKCS11) with an optional configure argument. • {-providerclass class [-providerarg arg]}: Add security provider by fully qualified class name with an optional configure argument. • {-providerpath list}: Provider classpath • {-v}: Verbose output • {-protected}: Password provided through a protected mechanism Use the -certreq command to generate a Certificate Signing Request (CSR) using the PKCS #10 format. A CSR is intended to be sent to a CA. The CA authenticates the certificate requestor (usually offline) and returns a certificate or certificate chain to replace the existing certificate chain (initially a self-signed certificate) in the keystore. The private key associated with alias is used to create the PKCS #10 certificate request. To access the private key, the correct password must be provided. If -keypass isn't provided at the command line and is different from the password used to protect the integrity of the keystore, then the user is prompted for it. If -dname is provided, then it is used as the subject in the CSR. Otherwise, the X.500 Distinguished Name associated with alias is used. The -sigalg value specifies the algorithm that should be used to sign the CSR. The CSR is stored in the -file file. If a file is not specified, then the CSR is output to -stdout. Use the -importcert command to import the response from the CA. COMMANDS FOR EXPORTING DATA -exportcert The following are the available options for the -exportcert command: • {-rfc}: Output in RFC style • {-alias alias}: Alias name of the entry to process • {-file file}: Output file name • {-keystore keystore}: Keystore name • {-cacerts}: Access the cacerts keystore • [-storepass arg]: Keystore password • {-storetype type}: Keystore type • {-providername name}: Provider name • {-addprovider name [-providerarg arg]}: Add security provider by name (such as SunPKCS11) with an optional configure argument. • {-providerclass class [-providerarg arg] }: Add security provider by fully qualified class name with an optional configure argument. • {-providerpath list}: Provider classpath • {-v}: Verbose output • {-protected}: Password provided through a protected mechanism Use the -exportcert command to read a certificate from the keystore that is associated with -alias alias and store it in the -file file. When a file is not specified, the certificate is output to stdout. By default, the certificate is output in binary encoding. If the -rfc option is specified, then the output in the printable encoding format defined by the Internet RFC 1421 Certificate Encoding Standard. If -alias refers to a trusted certificate, then that certificate is output. Otherwise, -alias refers to a key entry with an associated certificate chain. In that case, the first certificate in the chain is returned. This certificate authenticates the public key of the entity addressed by -alias. COMMANDS FOR DISPLAYING DATA -list The following are the available options for the -list command: • {-rfc}: Output in RFC style • {-alias alias}: Alias name of the entry to process • {-keystore keystore}: Keystore name • {-cacerts}: Access the cacerts keystore • [-storepass arg]: Keystore password • {-storetype type}: Keystore type • {-providername name}: Provider name • {-addprovider name [-providerarg arg]}: Add security provider by name (such as SunPKCS11) with an optional configure argument. • {-providerclass class [-providerarg arg] }: Add security provider by fully qualified class name with an optional configure argument. • {-providerpath list}: Provider classpath • {-v}: Verbose output • {-protected}: Password provided through a protected mechanism Use the -list command to print the contents of the keystore entry identified by -alias to stdout. If -alias alias is not specified, then the contents of the entire keystore are printed. By default, this command prints the SHA-256 fingerprint of a certificate. If the -v option is specified, then the certificate is printed in human-readable format, with additional information such as the owner, issuer, serial number, and any extensions. If the -rfc option is specified, then the certificate contents are printed by using the printable encoding format, as defined by the Internet RFC 1421 Certificate Encoding Standard. Note: You can't specify both -v and -rfc in the same command. Otherwise, an error is reported. -printcert The following are the available options for the -printcert command: • {-rfc}: Output in RFC style • {-file cert_file}: Input file name • {-sslserver server[:port]}:: Secure Sockets Layer (SSL) server host and port • {-jarfile JAR_file}: Signed .jar file • {-keystore keystore}: Keystore name • {-trustcacerts}: Trust certificates from cacerts • [-storepass arg]: Keystore password • {-storetype type}: Keystore type • {-providername name}: Provider name • {-addprovider name [-providerarg arg]}: Add security provider by name (such as SunPKCS11) with an optional configure argument. • {-providerclass class [-providerarg arg]}: Add security provider by fully qualified class name with an optional configure argument. • {-providerpath list}: Provider classpath • {-protected}: Password is provided through protected mechanism • {-v}: Verbose output Use the -printcert command to read and print the certificate from -file cert_file, the SSL server located at -sslserver server[:port], or the signed JAR file specified by -jarfile JAR_file. It prints its contents in a human-readable format. When a port is not specified, the standard HTTPS port 443 is assumed. Note: The -sslserver and -file options can't be provided in the same command. Otherwise, an error is reported. If you don't specify either option, then the certificate is read from stdin. When-rfc is specified, the keytool command prints the certificate in PEM mode as defined by the Internet RFC 1421 Certificate Encoding standard. If the certificate is read from a file or stdin, then it might be either binary encoded or in printable encoding format, as defined by the RFC 1421 Certificate Encoding standard. If the SSL server is behind a firewall, then the -J-Dhttps.proxyHost=proxyhost and -J-Dhttps.proxyPort=proxyport options can be specified on the command line for proxy tunneling. Note: This command can be used independently of a keystore. This command does not check for the weakness of a certificate's signature algorithm if it is a trusted certificate in the user keystore (specified by -keystore) or in the cacerts keystore (if -trustcacerts is specified). -printcertreq The following are the available options for the -printcertreq command: • {-file file}: Input file name • {-v}: Verbose output Use the -printcertreq command to print the contents of a PKCS #10 format certificate request, which can be generated by the keytool -certreq command. The command reads the request from file. If there is no file, then the request is read from the standard input. -printcrl The following are the available options for the -printcrl command: • {-file crl}: Input file name • {-keystore keystore}: Keystore name • {-trustcacerts}: Trust certificates from cacerts • [-storepass arg]: Keystore password • {-storetype type}: Keystore type • {-providername name}: Provider name • {-addprovider name [-providerarg arg]}: Add security provider by name (such as SunPKCS11) with an optional configure argument. • {-providerclass class [-providerarg arg]}: Add security provider by fully qualified class name with an optional configure argument. • {-providerpath list}: Provider classpath • {-protected}: Password is provided through protected mechanism • {-v}: Verbose output Use the -printcrl command to read the Certificate Revocation List (CRL) from -file crl . A CRL is a list of the digital certificates that were revoked by the CA that issued them. The CA generates the crl file. Note: This command can be used independently of a keystore. This command attempts to verify the CRL using a certificate from the user keystore (specified by -keystore) or the cacerts keystore (if -trustcacerts is specified), and will print out a warning if it cannot be verified. COMMANDS FOR MANAGING THE KEYSTORE -storepasswd The following are the available options for the -storepasswd command: • [-new arg]: New password • {-keystore keystore}: Keystore name • {-cacerts}: Access the cacerts keystore • [-storepass arg]: Keystore password • {-storetype type}: Keystore type • {-providername name}: Provider name • {-addprovider name [-providerarg arg]}: Add security provider by name (such as SunPKCS11) with an optional configure argument. • {-providerclass class [-providerarg arg]}: Add security provider by fully qualified class name with an optional configure argument. • {-providerpath list}: Provider classpath • {-v}: Verbose output Use the -storepasswd command to change the password used to protect the integrity of the keystore contents. The new password is set by -new arg and must contain at least six characters. -keypasswd The following are the available options for the -keypasswd command: • {-alias alias}: Alias name of the entry to process • [-keypass old_keypass]: Key password • [-new new_keypass]: New password • {-keystore keystore}: Keystore name • {-storepass arg}: Keystore password • {-storetype type}: Keystore type • {-providername name}: Provider name • {-addprovider name [-providerarg arg]}: Add security provider by name (such as SunPKCS11) with an optional configure argument. • {-providerclass class [-providerarg arg]}: Add security provider by fully qualified class name with an optional configure argument. • {-providerpath list}: Provider classpath • {-v}: Verbose output Use the -keypasswd command to change the password (under which private/secret keys identified by -alias are protected) from -keypass old_keypass to -new new_keypass. The password value must contain at least six characters. If the -keypass option isn't provided at the command line and the -keypass password is different from the keystore password (-storepass arg), then the user is prompted for it. If the -new option isn't provided at the command line, then the user is prompted for it. -delete The following are the available options for the -delete command: • [-alias alias]: Alias name of the entry to process • {-keystore keystore}: Keystore name • {-cacerts}: Access the cacerts keystore • [-storepass arg]: Keystore password • {-storetype type}: Keystore type • {-providername name}: Provider name • {-addprovider name [-providerarg arg]}: Add security provider by name (such as SunPKCS11) with an optional configure argument. • {-providerclass class [-providerarg arg]}: Add security provider by fully qualified class name with an optional configure argument. • {-providerpath list}: Provider classpath • {-v}: Verbose output • {-protected}: Password provided through a protected mechanism Use the -delete command to delete the -alias alias entry from the keystore. When not provided at the command line, the user is prompted for the alias. -changealias The following are the available options for the -changealias command: • {-alias alias}: Alias name of the entry to process • [-destalias alias]: Destination alias • [-keypass arg]: Key password • {-keystore keystore}: Keystore name • {-cacerts}: Access the cacerts keystore • [-storepass arg]: Keystore password • {-storetype type}: Keystore type • {-providername name}: Provider name • {-addprovider name [-providerarg arg]}: Add security provider by name (such as SunPKCS11) with an optional configure argument. • {-providerclass class [-providerarg arg]}: Add security provider by fully qualified class name with an optional configure argument. • {-providerpath list}: Provider classpath • {-v}: Verbose output • {-protected}: Password provided through a protected mechanism Use the -changealias command to move an existing keystore entry from -alias alias to a new -destalias alias. If a destination alias is not provided, then the command prompts you for one. If the original entry is protected with an entry password, then the password can be supplied with the -keypass option. If a key password is not provided, then the -storepass (if provided) is attempted first. If the attempt fails, then the user is prompted for a password. COMMANDS FOR DISPLAYING SECURITY-RELATED INFORMATION -showinfo The following are the available options for the -showinfo command: • {-tls}: Displays TLS configuration information • {-v}: Verbose output Use the -showinfo command to display various security-related information. The -tls option displays TLS configurations, such as the list of enabled protocols and cipher suites. COMMANDS FOR DISPLAYING PROGRAM VERSION You can use -version to print the program version of keytool. COMMANDS FOR DISPLAYING HELP INFORMATION You can use --help to display a list of keytool commands or to display help information about a specific keytool command. • To display a list of keytool commands, enter: keytool --help • To display help information about a specific keytool command, enter: keytool -<command> --help COMMON COMMAND OPTIONS The -v option can appear for all commands except --help. When the -v option appears, it signifies verbose mode, which means that more information is provided in the output. The -Joption argument can appear for any command. When the -Joption is used, the specified option string is passed directly to the Java interpreter. This option doesn't contain any spaces. It's useful for adjusting the execution environment or memory usage. For a list of possible interpreter options, enter java -h or java -X at the command line. These options can appear for all commands operating on a keystore: -storetype storetype This qualifier specifies the type of keystore to be instantiated. -keystore keystore The keystore location. If the JKS storetype is used and a keystore file doesn't yet exist, then certain keytool commands can result in a new keystore file being created. For example, if keytool -genkeypair is called and the -keystore option isn't specified, the default keystore file named .keystore is created in the user's home directory if it doesn't already exist. Similarly, if the -keystore ks_file option is specified but ks_file doesn't exist, then it is created. For more information on the JKS storetype, see the KeyStore Implementation section in KeyStore aliases. Note that the input stream from the -keystore option is passed to the KeyStore.load method. If NONE is specified as the URL, then a null stream is passed to the KeyStore.load method. NONE should be specified if the keystore isn't file-based. For example, when the keystore resides on a hardware token device. -cacerts cacerts Operates on the cacerts keystore . This option is equivalent to -keystore path_to_cacerts -storetype type_of_cacerts. An error is reported if the -keystore or -storetype option is used with the -cacerts option. -storepass [:env | :file ] argument The password that is used to protect the integrity of the keystore. If the modifier env or file isn't specified, then the password has the value argument, which must contain at least six characters. Otherwise, the password is retrieved as follows: • env: Retrieve the password from the environment variable named argument. • file: Retrieve the password from the file named argument. Note: All other options that require passwords, such as -keypass, -srckeypass, -destkeypass, -srcstorepass, and -deststorepass, accept the env and file modifiers. Remember to separate the password option and the modifier with a colon (:). The password must be provided to all commands that access the keystore contents. For such commands, when the -storepass option isn't provided at the command line, the user is prompted for it. When retrieving information from the keystore, the password is optional. If a password is not specified, then the integrity of the retrieved information can't be verified and a warning is displayed. -providername name Used to identify a cryptographic service provider's name when listed in the security properties file. -addprovider name Used to add a security provider by name (such as SunPKCS11) . -providerclass class Used to specify the name of a cryptographic service provider's master class file when the service provider isn't listed in the security properties file. -providerpath list Used to specify the provider classpath. -providerarg arg Used with the -addprovider or -providerclass option to represent an optional string input argument for the constructor of class name. -protected=true|false Specify this value as true when a password must be specified by way of a protected authentication path, such as a dedicated PIN reader. Because there are two keystores involved in the -importkeystore command, the following two options, -srcprotected and -destprotected, are provided for the source keystore and the destination keystore respectively. -ext {name{:critical} {=value}} Denotes an X.509 certificate extension. The option can be used in -genkeypair and -gencert to embed extensions into the generated certificate, or in -certreq to show what extensions are requested in the certificate request. The option can appear multiple times. The name argument can be a supported extension name (see Supported Named Extensions) or an arbitrary OID number. The value argument, when provided, denotes the argument for the extension. When value is omitted, the default value of the extension or the extension itself requires no argument. The :critical modifier, when provided, means the extension's isCritical attribute is true; otherwise, it is false. You can use :c in place of :critical. -conf file Specifies a pre-configured options file. PRE-CONFIGURED OPTIONS FILE A pre-configured options file is a Java properties file that can be specified with the -conf option. Each property represents the default option(s) for a keytool command using "keytool.command_name" as the property name. A special property named "keytool.all" represents the default option(s) applied to all commands. A property value can include ${prop} which will be expanded to the system property associated with it. If an option value includes white spaces inside, it should be surrounded by quotation marks (" or '). All property names must be in lower case. When keytool is launched with a pre-configured options file, the value for "keytool.all" (if it exists) is prepended to the keytool command line first, with the value for the command name (if it exists) comes next, and the existing options on the command line at last. For a single-valued option, this allows the property for a specific command to override the "keytool.all" value, and the value specified on the command line to override both. For multiple-valued options, all of them will be used by keytool. For example, given the following file named preconfig: # A tiny pre-configured options file keytool.all = -keystore ${user.home}/ks keytool.list = -v keytool.genkeypair = -keyalg rsa keytool -conf preconfig -list is identical to keytool -keystore ~/ks -v -list keytool -conf preconfig -genkeypair -alias me is identical to keytool -keystore ~/ks -keyalg rsa -genkeypair -alias me keytool -conf preconfig -genkeypair -alias you -keyalg ec is identical to keytool -keystore ~/ks -keyalg rsa -genkeypair -alias you -keyalg ec which is equivalent to keytool -keystore ~/ks -genkeypair -alias you -keyalg ec because -keyalg is a single-valued option and the ec value specified on the command line overrides the preconfigured options file. EXAMPLES OF OPTION VALUES The following examples show the defaults for various option values: -alias "mykey" -keysize 2048 (when using -genkeypair and -keyalg is "DSA") 3072 (when using -genkeypair and -keyalg is "RSA", "RSASSA-PSS", or "DH") 384 (when using -genkeypair and -keyalg is "EC") 56 (when using -genseckey and -keyalg is "DES") 168 (when using -genseckey and -keyalg is "DESede") -groupname ed25519 (when using -genkeypair and -keyalg is "EdDSA", key size is 255) x25519 (when using -genkeypair and -keyalg is "XDH", key size is 255) -validity 90 -keystore <the file named .keystore in the user's home directory> -destkeystore <the file named .keystore in the user's home directory> -storetype <the value of the "keystore.type" property in the security properties file, which is returned by the static getDefaultType method in java.security.KeyStore> -file stdin (if reading) stdout (if writing) -protected false When generating a certificate or a certificate request, the default signature algorithm (-sigalg option) is derived from the algorithm of the underlying private key to provide an appropriate level of security strength as follows: Default Signature Algorithms keyalg key size default sigalg ─────────────────────────────────────────── DSA any size SHA256withDSA RSA < 624 SHA256withRSA (key size is too small for using SHA-384) <= 7680 SHA384withRSA > 7680 SHA512withRSA EC < 512 SHA384withECDSA >= 512 SHA512withECDSA RSASSA-PSS < 624 RSASSA-PSS (with SHA-256, key size is too small for using SHA-384) <= 7680 RSASSA-PSS (with SHA-384) > 7680 RSASSA-PSS (with SHA-512) EdDSA 255 Ed25519 448 Ed448 Ed25519 255 Ed25519 Ed448 448 Ed448 • The key size, measured in bits, corresponds to the size of the private key. This size is determined by the value of the -keysize or -groupname options or the value derived from a default setting. • An RSASSA-PSS signature algorithm uses a MessageDigest algorithm as its hash and MGF1 algorithms. • If neither a default -keysize or -groupname is defined for an algorithm, the security provider will choose a default setting. Note: To improve out of the box security, default keysize, groupname, and signature algorithm names are periodically updated to stronger values with each release of the JDK. If interoperability with older releases of the JDK is important, make sure that the defaults are supported by those releases. Alternatively, you can use the -keysize, -groupname, or -sigalg options to override the default values at your own risk. SUPPORTED NAMED EXTENSIONS The keytool command supports these named extensions. The names aren't case-sensitive. BC or BasicContraints Values: The full form is ca:{true|false}[,pathlen:len] or len, which is short for ca:true,pathlen:len. When len is omitted, the resulting value is ca:true. KU or KeyUsage Values: usage(, usage)* usage can be one of the following: • digitalSignature • nonRepudiation (contentCommitment) • keyEncipherment • dataEncipherment • keyAgreement • keyCertSign • cRLSign • encipherOnly • decipherOnly Provided there is no ambiguity, the usage argument can be abbreviated with the first few letters (such as dig for digitalSignature) or in camel-case style (such as dS for digitalSignature or cRLS for cRLSign). The usage values are case-sensitive. EKU or ExtendedKeyUsage Values: usage(, usage)* usage can be one of the following: • anyExtendedKeyUsage • serverAuth • clientAuth • codeSigning • emailProtection • timeStamping • OCSPSigning • Any OID string Provided there is no ambiguity, the usage argument can be abbreviated with the first few letters or in camel-case style. The usage values are case-sensitive. SAN or SubjectAlternativeName Values: type:value(, type:value)* type can be one of the following: • EMAIL • URI • DNS • IP • OID The value argument is the string format value for the type. IAN or IssuerAlternativeName Values: Same as SAN or SubjectAlternativeName. SIA or SubjectInfoAccess Values: method:location-type:location-value(, method:location-type:location-value)* method can be one of the following: • timeStamping • caRepository • Any OID The location-type and location-value arguments can be any type:value supported by the SubjectAlternativeName extension. AIA or AuthorityInfoAccess Values: Same as SIA or SubjectInfoAccess. The method argument can be one of the following: • ocsp • caIssuers • Any OID When name is OID, the value is the hexadecimal dumped Definite Encoding Rules (DER) encoding of the extnValue for the extension excluding the OCTET STRING type and length bytes. Other than standard hexadecimal numbers (0-9, a-f, A-F), any extra characters are ignored in the HEX string. Therefore, both 01:02:03:04 and 01020304 are accepted as identical values. When there is no value, the extension has an empty value field. A special name honored, used only in -gencert, denotes how the extensions included in the certificate request should be honored. The value for this name is a comma-separated list of all (all requested extensions are honored), name{:[critical|non-critical]} (the named extension is honored, but it uses a different isCritical attribute), and -name (used with all, denotes an exception). Requested extensions aren't honored by default. If, besides the-ext honored option, another named or OID -ext option is provided, this extension is added to those already honored. However, if this name (or OID) also appears in the honored value, then its value and criticality override that in the request. If an extension of the same type is provided multiple times through either a name or an OID, only the last extension is used. The subjectKeyIdentifier extension is always created. For non-self- signed certificates, the authorityKeyIdentifier is created. CAUTION: Users should be aware that some combinations of extensions (and other certificate fields) may not conform to the Internet standard. See Certificate Conformance Warning. EXAMPLES OF TASKS IN CREATING A KEYSTORE The following examples describe the sequence actions in creating a keystore for managing public/private key pairs and certificates from trusted entities. • Generating the Key Pair • Requesting a Signed Certificate from a CA • Importing a Certificate for the CA • Importing the Certificate Reply from the CA • Exporting a Certificate That Authenticates the Public Key • Importing the Keystore • Generating Certificates for an SSL Server GENERATING THE KEY PAIR Create a keystore and then generate the key pair. You can enter the command as a single line such as the following: keytool -genkeypair -dname "cn=myname, ou=mygroup, o=mycompany, c=mycountry" -alias business -keyalg rsa -keypass password -keystore /working/mykeystore -storepass password -validity 180 The command creates the keystore named mykeystore in the working directory (provided it doesn't already exist), and assigns it the password specified by -keypass. It generates a public/private key pair for the entity whose distinguished name is myname, mygroup, mycompany, and a two-letter country code of mycountry. It uses the RSA key generation algorithm to create the keys; both are 3072 bits. The command uses the default SHA384withRSA signature algorithm to create a self-signed certificate that includes the public key and the distinguished name information. The certificate is valid for 180 days, and is associated with the private key in a keystore entry referred to by -alias business. The private key is assigned the password specified by -keypass. The command is significantly shorter when the option defaults are accepted. In this case, only -keyalg is required, and the defaults are used for unspecified options that have default values. You are prompted for any required values. You could have the following: keytool -genkeypair -keyalg rsa In this case, a keystore entry with the alias mykey is created, with a newly generated key pair and a certificate that is valid for 90 days. This entry is placed in your home directory in a keystore named .keystore . .keystore is created if it doesn't already exist. You are prompted for the distinguished name information, the keystore password, and the private key password. Note: The rest of the examples assume that you responded to the prompts with values equal to those specified in the first -genkeypair command. For example, a distinguished name of cn=myname, ou=mygroup, o=mycompany, c=mycountry). REQUESTING A SIGNED CERTIFICATE FROM A CA Note: Generating the key pair created a self-signed certificate; however, a certificate is more likely to be trusted by others when it is signed by a CA. To get a CA signature, complete the following process: 1. Generate a CSR: keytool -certreq -file myname.csr This creates a CSR for the entity identified by the default alias mykey and puts the request in the file named myname.csr. 2. Submit myname.csr to a CA, such as DigiCert. The CA authenticates you, the requestor (usually offline), and returns a certificate, signed by them, authenticating your public key. In some cases, the CA returns a chain of certificates, each one authenticating the public key of the signer of the previous certificate in the chain. IMPORTING A CERTIFICATE FOR THE CA To import a certificate for the CA, complete the following process: 1. Before you import the certificate reply from a CA, you need one or more trusted certificates either in your keystore or in the cacerts keystore file. See -importcert in Commands. • If the certificate reply is a certificate chain, then you need the top certificate of the chain. The root CA certificate that authenticates the public key of the CA. • If the certificate reply is a single certificate, then you need a certificate for the issuing CA (the one that signed it). If that certificate isn't self-signed, then you need a certificate for its signer, and so on, up to a self-signed root CA certificate. The cacerts keystore ships with a set of root certificates issued by the CAs of the Oracle Java Root Certificate program [http://www.oracle.com/technetwork/java/javase/javasecarootcertsprogram-1876540.html]. If you request a signed certificate from a CA, and a certificate authenticating that CA's public key hasn't been added to cacerts, then you must import a certificate from that CA as a trusted certificate. A certificate from a CA is usually self-signed or signed by another CA. If it is signed by another CA, you need a certificate that authenticates that CA's public key. For example, you have obtained a X.cer file from a company that is a CA and the file is supposed to be a self-signed certificate that authenticates that CA's public key. Before you import it as a trusted certificate, you should ensure that the certificate is valid by: 1. Viewing it with the keytool -printcert command or the keytool -importcert command without using the -noprompt option. Make sure that the displayed certificate fingerprints match the expected fingerprints. 2. Calling the person who sent the certificate, and comparing the fingerprints that you see with the ones that they show or that a secure public key repository shows. Only when the fingerprints are equal is it assured that the certificate wasn't replaced in transit with somebody else's certificate (such as an attacker's certificate). If such an attack takes place, and you didn't check the certificate before you imported it, then you would be trusting anything that the attacker signed. 2. Replace the self-signed certificate with a certificate chain, where each certificate in the chain authenticates the public key of the signer of the previous certificate in the chain, up to a root CA. If you trust that the certificate is valid, then you can add it to your keystore by entering the following command: keytool -importcert -alias alias -file *X*.cer` This command creates a trusted certificate entry in the keystore from the data in the CA certificate file and assigns the values of the alias to the entry. IMPORTING THE CERTIFICATE REPLY FROM THE CA After you import a certificate that authenticates the public key of the CA that you submitted your certificate signing request to (or there is already such a certificate in the cacerts file), you can import the certificate reply and replace your self-signed certificate with a certificate chain. The certificate chain is one of the following: • Returned by the CA when the CA reply is a chain. • Constructed when the CA reply is a single certificate. This certificate chain is constructed by using the certificate reply and trusted certificates available either in the keystore where you import the reply or in the cacerts keystore file. For example, if you sent your certificate signing request to DigiCert, then you can import their reply by entering the following command: Note: In this example, the returned certificate is named DCmyname.cer. keytool -importcert -trustcacerts -file DCmyname.cer EXPORTING A CERTIFICATE THAT AUTHENTICATES THE PUBLIC KEY Note: If you used the jarsigner command to sign a Java Archive (JAR) file, then clients that use the file will want to authenticate your signature. One way that clients can authenticate you is by importing your public key certificate into their keystore as a trusted entry. You can then export the certificate and supply it to your clients. For example: 1. Copy your certificate to a file named myname.cer by entering the following command: Note: In this example, the entry has an alias of mykey. keytool -exportcert -alias mykey -file myname.cer 2. With the certificate and the signed JAR file, a client can use the jarsigner command to authenticate your signature. IMPORTING THE KEYSTORE Use the importkeystore command to import an entire keystore into another keystore. This imports all entries from the source keystore, including keys and certificates, to the destination keystore with a single command. You can use this command to import entries from a different type of keystore. During the import, all new entries in the destination keystore will have the same alias names and protection passwords (for secret keys and private keys). If the keytool command can't recover the private keys or secret keys from the source keystore, then it prompts you for a password. If it detects alias duplication, then it asks you for a new alias, and you can specify a new alias or simply allow the keytool command to overwrite the existing one. For example, import entries from a typical JKS type keystore key.jks into a PKCS #11 type hardware-based keystore, by entering the following command: keytool -importkeystore -srckeystore key.jks -destkeystore NONE -srcstoretype JKS -deststoretype PKCS11 -srcstorepass password -deststorepass password The importkeystore command can also be used to import a single entry from a source keystore to a destination keystore. In this case, besides the options you used in the previous example, you need to specify the alias you want to import. With the -srcalias option specified, you can also specify the destination alias name, protection password for a secret or private key, and the destination protection password you want as follows: keytool -importkeystore -srckeystore key.jks -destkeystore NONE -srcstoretype JKS -deststoretype PKCS11 -srcstorepass password -deststorepass password -srcalias myprivatekey -destalias myoldprivatekey -srckeypass password -destkeypass password -noprompt GENERATING CERTIFICATES FOR AN SSL SERVER The following are keytool commands used to generate key pairs and certificates for three entities: • Root CA (root) • Intermediate CA (ca) • SSL server (server) Ensure that you store all the certificates in the same keystore. keytool -genkeypair -keystore root.jks -alias root -ext bc:c -keyalg rsa keytool -genkeypair -keystore ca.jks -alias ca -ext bc:c -keyalg rsa keytool -genkeypair -keystore server.jks -alias server -keyalg rsa keytool -keystore root.jks -alias root -exportcert -rfc > root.pem keytool -storepass password -keystore ca.jks -certreq -alias ca | keytool -storepass password -keystore root.jks -gencert -alias root -ext BC=0 -rfc > ca.pem keytool -keystore ca.jks -importcert -alias ca -file ca.pem keytool -storepass password -keystore server.jks -certreq -alias server | keytool -storepass password -keystore ca.jks -gencert -alias ca -ext ku:c=dig,kE -rfc > server.pem cat root.pem ca.pem server.pem | keytool -keystore server.jks -importcert -alias server TERMS Keystore A keystore is a storage facility for cryptographic keys and certificates. Keystore entries Keystores can have different types of entries. The two most applicable entry types for the keytool command include the following: Key entries: Each entry holds very sensitive cryptographic key information, which is stored in a protected format to prevent unauthorized access. Typically, a key stored in this type of entry is a secret key, or a private key accompanied by the certificate chain for the corresponding public key. See Certificate Chains. The keytool command can handle both types of entries, while the jarsigner tool only handles the latter type of entry, that is private keys and their associated certificate chains. Trusted certificate entries: Each entry contains a single public key certificate that belongs to another party. The entry is called a trusted certificate because the keystore owner trusts that the public key in the certificate belongs to the identity identified by the subject (owner) of the certificate. The issuer of the certificate vouches for this, by signing the certificate. Keystore aliases All keystore entries (key and trusted certificate entries) are accessed by way of unique aliases. An alias is specified when you add an entity to the keystore with the -genseckey command to generate a secret key, the -genkeypair command to generate a key pair (public and private key), or the -importcert command to add a certificate or certificate chain to the list of trusted certificates. Subsequent keytool commands must use this same alias to refer to the entity. For example, you can use the alias duke to generate a new public/private key pair and wrap the public key into a self- signed certificate with the following command. See Certificate Chains. keytool -genkeypair -alias duke -keyalg rsa -keypass passwd This example specifies an initial passwd required by subsequent commands to access the private key associated with the alias duke. If you later want to change Duke's private key password, use a command such as the following: keytool -keypasswd -alias duke -keypass passwd -new newpasswd This changes the initial passwd to newpasswd. A password shouldn't be specified on a command line or in a script unless it is for testing purposes, or you are on a secure system. If you don't specify a required password option on a command line, then you are prompted for it. Keystore implementation The KeyStore class provided in the java.security package supplies well-defined interfaces to access and modify the information in a keystore. It is possible for there to be multiple different concrete implementations, where each implementation is that for a particular type of keystore. Currently, two command-line tools (keytool and jarsigner) make use of keystore implementations. Because the KeyStore class is public, users can write additional security applications that use it. In JDK 9 and later, the default keystore implementation is PKCS12. This is a cross platform keystore based on the RSA PKCS12 Personal Information Exchange Syntax Standard. This standard is primarily meant for storing or transporting a user's private keys, certificates, and miscellaneous secrets. There is another built-in implementation, provided by Oracle. It implements the keystore as a file with a proprietary keystore type (format) named JKS. It protects each private key with its individual password, and also protects the integrity of the entire keystore with a (possibly different) password. Keystore implementations are provider-based. More specifically, the application interfaces supplied by KeyStore are implemented in terms of a Service Provider Interface (SPI). That is, there is a corresponding abstract KeystoreSpi class, also in the java.security package, which defines the Service Provider Interface methods that providers must implement. The term provider refers to a package or a set of packages that supply a concrete implementation of a subset of services that can be accessed by the Java Security API. To provide a keystore implementation, clients must implement a provider and supply a KeystoreSpi subclass implementation, as described in Steps to Implement and Integrate a Provider. Applications can choose different types of keystore implementations from different providers, using the getInstance factory method supplied in the KeyStore class. A keystore type defines the storage and data format of the keystore information, and the algorithms used to protect private/secret keys in the keystore and the integrity of the keystore. Keystore implementations of different types aren't compatible. The keytool command works on any file-based keystore implementation. It treats the keystore location that is passed to it at the command line as a file name and converts it to a FileInputStream, from which it loads the keystore information.)The jarsigner commands can read a keystore from any location that can be specified with a URL. For keytool and jarsigner, you can specify a keystore type at the command line, with the -storetype option. If you don't explicitly specify a keystore type, then the tools choose a keystore implementation based on the value of the keystore.type property specified in the security properties file. The security properties file is called java.security, and resides in the security properties directory: • Linux and macOS: java.home/lib/security • Windows: java.home\lib\security Each tool gets the keystore.type value and then examines all the currently installed providers until it finds one that implements a keystores of that type. It then uses the keystore implementation from that provider.The KeyStore class defines a static method named getDefaultType that lets applications retrieve the value of the keystore.type property. The following line of code creates an instance of the default keystore type as specified in the keystore.type property: KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); The default keystore type is pkcs12, which is a cross-platform keystore based on the RSA PKCS12 Personal Information Exchange Syntax Standard. This is specified by the following line in the security properties file: keystore.type=pkcs12 To have the tools utilize a keystore implementation other than the default, you can change that line to specify a different keystore type. For example, if you want to use the Oracle's jks keystore implementation, then change the line to the following: keystore.type=jks Note: Case doesn't matter in keystore type designations. For example, JKS would be considered the same as jks. Certificate A certificate (or public-key certificate) is a digitally signed statement from one entity (the issuer), saying that the public key and some other information of another entity (the subject) has some specific value. The following terms are related to certificates: • Public Keys: These are numbers associated with a particular entity, and are intended to be known to everyone who needs to have trusted interactions with that entity. Public keys are used to verify signatures. • Digitally Signed: If some data is digitally signed, then it is stored with the identity of an entity and a signature that proves that entity knows about the data. The data is rendered unforgeable by signing with the entity's private key. • Identity: A known way of addressing an entity. In some systems, the identity is the public key, and in others it can be anything from an Oracle Solaris UID to an email address to an X.509 distinguished name. • Signature: A signature is computed over some data using the private key of an entity. The signer, which in the case of a certificate is also known as the issuer. • Private Keys: These are numbers, each of which is supposed to be known only to the particular entity whose private key it is (that is, it is supposed to be kept secret). Private and public keys exist in pairs in all public key cryptography systems (also referred to as public key crypto systems). In a typical public key crypto system, such as DSA, a private key corresponds to exactly one public key. Private keys are used to compute signatures. • Entity: An entity is a person, organization, program, computer, business, bank, or something else you are trusting to some degree. Public key cryptography requires access to users' public keys. In a large-scale networked environment, it is impossible to guarantee that prior relationships between communicating entities were established or that a trusted repository exists with all used public keys. Certificates were invented as a solution to this public key distribution problem. Now a Certification Authority (CA) can act as a trusted third party. CAs are entities such as businesses that are trusted to sign (issue) certificates for other entities. It is assumed that CAs only create valid and reliable certificates because they are bound by legal agreements. There are many public Certification Authorities, such as DigiCert, Comodo, Entrust, and so on. You can also run your own Certification Authority using products such as Microsoft Certificate Server or the Entrust CA product for your organization. With the keytool command, it is possible to display, import, and export certificates. It is also possible to generate self-signed certificates. The keytool command currently handles X.509 certificates. X.509 Certificates The X.509 standard defines what information can go into a certificate and describes how to write it down (the data format). All the data in a certificate is encoded with two related standards called ASN.1/DER. Abstract Syntax Notation 1 describes data. The Definite Encoding Rules describe a single way to store and transfer that data. All X.509 certificates have the following data, in addition to the signature: • Version: This identifies which version of the X.509 standard applies to this certificate, which affects what information can be specified in it. Thus far, three versions are defined. The keytool command can import and export v1, v2, and v3 certificates. It generates v3 certificates. • X.509 Version 1 has been available since 1988, is widely deployed, and is the most generic. • X.509 Version 2 introduced the concept of subject and issuer unique identifiers to handle the possibility of reuse of subject or issuer names over time. Most certificate profile documents strongly recommend that names not be reused and that certificates shouldn't make use of unique identifiers. Version 2 certificates aren't widely used. • X.509 Version 3 is the most recent (1996) and supports the notion of extensions where anyone can define an extension and include it in the certificate. Some common extensions are: KeyUsage (limits the use of the keys to particular purposes such as signing-only) and AlternativeNames (allows other identities to also be associated with this public key, for example. DNS names, email addresses, IP addresses). Extensions can be marked critical to indicate that the extension should be checked and enforced or used. For example, if a certificate has the KeyUsage extension marked critical and set to keyCertSign, then when this certificate is presented during SSL communication, it should be rejected because the certificate extension indicates that the associated private key should only be used for signing certificates and not for SSL use. • Serial number: The entity that created the certificate is responsible for assigning it a serial number to distinguish it from other certificates it issues. This information is used in numerous ways. For example, when a certificate is revoked its serial number is placed in a Certificate Revocation List (CRL). • Signature algorithm identifier: This identifies the algorithm used by the CA to sign the certificate. • Issuer name: The X.500 Distinguished Name of the entity that signed the certificate. This is typically a CA. Using this certificate implies trusting the entity that signed this certificate. In some cases, such as root or top-level CA certificates, the issuer signs its own certificate. • Validity period: Each certificate is valid only for a limited amount of time. This period is described by a start date and time and an end date and time, and can be as short as a few seconds or almost as long as a century. The validity period chosen depends on a number of factors, such as the strength of the private key used to sign the certificate, or the amount one is willing to pay for a certificate. This is the expected period that entities can rely on the public value, when the associated private key has not been compromised. • Subject name: The name of the entity whose public key the certificate identifies. This name uses the X.500 standard, so it is intended to be unique across the Internet. This is the X.500 Distinguished Name (DN) of the entity. For example, CN=Java Duke, OU=Java Software Division, O=Oracle Corporation, C=US These refer to the subject's common name (CN), organizational unit (OU), organization (O), and country (C). • Subject public key information: This is the public key of the entity being named with an algorithm identifier that specifies which public key crypto system this key belongs to and any associated key parameters. Certificate Chains The keytool command can create and manage keystore key entries that each contain a private key and an associated certificate chain. The first certificate in the chain contains the public key that corresponds to the private key. When keys are first generated, the chain usually starts off containing a single element, a self-signed certificate. See -genkeypair in Commands. A self-signed certificate is one for which the issuer (signer) is the same as the subject. The subject is the entity whose public key is being authenticated by the certificate. When the -genkeypair command is called to generate a new public/private key pair, it also wraps the public key into a self-signed certificate (unless the -signer option is specified). Later, after a Certificate Signing Request (CSR) was generated with the -certreq command and sent to a Certification Authority (CA), the response from the CA is imported with -importcert, and the self-signed certificate is replaced by a chain of certificates. At the bottom of the chain is the certificate (reply) issued by the CA authenticating the subject's public key. The next certificate in the chain is one that authenticates the CA's public key. In many cases, this is a self-signed certificate, which is a certificate from the CA authenticating its own public key, and the last certificate in the chain. In other cases, the CA might return a chain of certificates. In this case, the bottom certificate in the chain is the same (a certificate signed by the CA, authenticating the public key of the key entry), but the second certificate in the chain is a certificate signed by a different CA that authenticates the public key of the CA you sent the CSR to. The next certificate in the chain is a certificate that authenticates the second CA's key, and so on, until a self-signed root certificate is reached. Each certificate in the chain (after the first) authenticates the public key of the signer of the previous certificate in the chain. Many CAs only return the issued certificate, with no supporting chain, especially when there is a flat hierarchy (no intermediates CAs). In this case, the certificate chain must be established from trusted certificate information already stored in the keystore. A different reply format (defined by the PKCS #7 standard) includes the supporting certificate chain in addition to the issued certificate. Both reply formats can be handled by the keytool command. The top-level (root) CA certificate is self-signed. However, the trust into the root's public key doesn't come from the root certificate itself, but from other sources such as a newspaper. This is because anybody could generate a self-signed certificate with the distinguished name of, for example, the DigiCert root CA. The root CA public key is widely known. The only reason it is stored in a certificate is because this is the format understood by most tools, so the certificate in this case is only used as a vehicle to transport the root CA's public key. Before you add the root CA certificate to your keystore, you should view it with the -printcert option and compare the displayed fingerprint with the well-known fingerprint obtained from a newspaper, the root CA's Web page, and so on. cacerts Certificates File A certificates file named cacerts resides in the security properties directory: • Linux and macOS: JAVA_HOME/lib/security • Windows: JAVA_HOME\lib\security The cacerts file represents a system-wide keystore with CA certificates. System administrators can configure and manage that file with the keytool command by specifying jks as the keystore type. The cacerts keystore file ships with a default set of root CA certificates. For Linux, macOS, and Windows, you can list the default certificates with the following command: keytool -list -cacerts The initial password of the cacerts keystore file is changeit. System administrators should change that password and the default access permission of that file upon installing the SDK. Note: It is important to verify your cacerts file. Because you trust the CAs in the cacerts file as entities for signing and issuing certificates to other entities, you must manage the cacerts file carefully. The cacerts file should contain only certificates of the CAs you trust. It is your responsibility to verify the trusted root CA certificates bundled in the cacerts file and make your own trust decisions. To remove an untrusted CA certificate from the cacerts file, use the -delete option of the keytool command. You can find the cacerts file in the JDK's $JAVA_HOME/lib/security directory. Contact your system administrator if you don't have permission to edit this file. Internet RFC 1421 Certificate Encoding Standard Certificates are often stored using the printable encoding format defined by the Internet RFC 1421 standard, instead of their binary encoding. This certificate format, also known as Base64 encoding, makes it easy to export certificates to other applications by email or through some other mechanism. Certificates read by the -importcert and -printcert commands can be in either this format or binary encoded. The -exportcert command by default outputs a certificate in binary encoding, but will instead output a certificate in the printable encoding format, when the -rfc option is specified. The -list command by default prints the SHA-256 fingerprint of a certificate. If the -v option is specified, then the certificate is printed in human-readable format. If the -rfc option is specified, then the certificate is output in the printable encoding format. In its printable encoding format, the encoded certificate is bounded at the beginning and end by the following text: -----BEGIN CERTIFICATE----- encoded certificate goes here. -----END CERTIFICATE----- X.500 Distinguished Names X.500 Distinguished Names are used to identify entities, such as those that are named by the subject and issuer (signer) fields of X.509 certificates. The keytool command supports the following subparts: • commonName: The common name of a person such as Susan Jones. • organizationUnit: The small organization (such as department or division) name. For example, Purchasing. • localityName: The locality (city) name, for example, Palo Alto. • stateName: State or province name, for example, California. • country: Two-letter country code, for example, CH. When you supply a distinguished name string as the value of a -dname option, such as for the -genkeypair command, the string must be in the following format: CN=cName, OU=orgUnit, O=org, L=city, S=state, C=countryCode All the following items represent actual values and the previous keywords are abbreviations for the following: CN=commonName OU=organizationUnit O=organizationName L=localityName S=stateName C=country A sample distinguished name string is: CN=Mark Smith, OU=Java, O=Oracle, L=Cupertino, S=California, C=US A sample command using such a string is: keytool -genkeypair -dname "CN=Mark Smith, OU=Java, O=Oracle, L=Cupertino, S=California, C=US" -alias mark -keyalg rsa Case doesn't matter for the keyword abbreviations. For example, CN, cn, and Cn are all treated the same. Order matters; each subcomponent must appear in the designated order. However, it isn't necessary to have all the subcomponents. You can use a subset, for example: CN=Smith, OU=Java, O=Oracle, C=US If a distinguished name string value contains a comma, then the comma must be escaped by a backslash (\) character when you specify the string on a command line, as in: cn=Jack, ou=Java\, Product Development, o=Oracle, c=US It is never necessary to specify a distinguished name string on a command line. When the distinguished name is needed for a command, but not supplied on the command line, the user is prompted for each of the subcomponents. In this case, a comma doesn't need to be escaped by a backslash (\). WARNINGS IMPORTING TRUSTED CERTIFICATES WARNING Important: Be sure to check a certificate very carefully before importing it as a trusted certificate. Windows Example: View the certificate first with the -printcert command or the -importcert command without the -noprompt option. Ensure that the displayed certificate fingerprints match the expected ones. For example, suppose someone sends or emails you a certificate that you put it in a file named \tmp\cert. Before you consider adding the certificate to your list of trusted certificates, you can execute a -printcert command to view its fingerprints, as follows: keytool -printcert -file \tmp\cert Owner: CN=ll, OU=ll, O=ll, L=ll, S=ll, C=ll Issuer: CN=ll, OU=ll, O=ll, L=ll, S=ll, C=ll Serial Number: 59092b34 Valid from: Thu Jun 24 18:01:13 PDT 2016 until: Wed Jun 23 17:01:13 PST 2016 Certificate Fingerprints: SHA-1: 20:B6:17:FA:EF:E5:55:8A:D0:71:1F:E8:D6:9D:C0:37:13:0E:5E:FE SHA-256: 90:7B:70:0A:EA:DC:16:79:92:99:41:FF:8A:FE:EB:90: 17:75:E0:90:B2:24:4D:3A:2A:16:A6:E4:11:0F:67:A4 Linux Example: View the certificate first with the -printcert command or the -importcert command without the -noprompt option. Ensure that the displayed certificate fingerprints match the expected ones. For example, suppose someone sends or emails you a certificate that you put it in a file named /tmp/cert. Before you consider adding the certificate to your list of trusted certificates, you can execute a -printcert command to view its fingerprints, as follows: keytool -printcert -file /tmp/cert Owner: CN=ll, OU=ll, O=ll, L=ll, S=ll, C=ll Issuer: CN=ll, OU=ll, O=ll, L=ll, S=ll, C=ll Serial Number: 59092b34 Valid from: Thu Jun 24 18:01:13 PDT 2016 until: Wed Jun 23 17:01:13 PST 2016 Certificate Fingerprints: SHA-1: 20:B6:17:FA:EF:E5:55:8A:D0:71:1F:E8:D6:9D:C0:37:13:0E:5E:FE SHA-256: 90:7B:70:0A:EA:DC:16:79:92:99:41:FF:8A:FE:EB:90: 17:75:E0:90:B2:24:4D:3A:2A:16:A6:E4:11:0F:67:A4 Then call or otherwise contact the person who sent the certificate and compare the fingerprints that you see with the ones that they show. Only when the fingerprints are equal is it guaranteed that the certificate wasn't replaced in transit with somebody else's certificate such as an attacker's certificate. If such an attack took place, and you didn't check the certificate before you imported it, then you would be trusting anything the attacker signed, for example, a JAR file with malicious class files inside. Note: It isn't required that you execute a -printcert command before importing a certificate. This is because before you add a certificate to the list of trusted certificates in the keystore, the -importcert command prints out the certificate information and prompts you to verify it. You can then stop the import operation. However, you can do this only when you call the -importcert command without the -noprompt option. If the -noprompt option is specified, then there is no interaction with the user. PASSWORDS WARNING Most commands that operate on a keystore require the store password. Some commands require a private/secret key password. Passwords can be specified on the command line in the -storepass and -keypass options. However, a password shouldn't be specified on a command line or in a script unless it is for testing, or you are on a secure system. When you don't specify a required password option on a command line, you are prompted for it. CERTIFICATE CONFORMANCE WARNING Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile [https://tools.ietf.org/rfc/rfc5280.txt] defined a profile on conforming X.509 certificates, which includes what values and value combinations are valid for certificate fields and extensions. The keytool command doesn't enforce all of these rules so it can generate certificates that don't conform to the standard, such as self- signed certificates that would be used for internal testing purposes. Certificates that don't conform to the standard might be rejected by the JDK or other applications. Users should ensure that they provide the correct options for -dname, -ext, and so on. IMPORT A NEW TRUSTED CERTIFICATE Before you add the certificate to the keystore, the keytool command verifies it by attempting to construct a chain of trust from that certificate to a self-signed certificate (belonging to a root CA), using trusted certificates that are already available in the keystore. If the -trustcacerts option was specified, then additional certificates are considered for the chain of trust, namely the certificates in a file named cacerts. If the keytool command fails to establish a trust path from the certificate to be imported up to a self-signed certificate (either from the keystore or the cacerts file), then the certificate information is printed, and the user is prompted to verify it by comparing the displayed certificate fingerprints with the fingerprints obtained from some other (trusted) source of information, which might be the certificate owner. Be very careful to ensure the certificate is valid before importing it as a trusted certificate. The user then has the option of stopping the import operation. If the -noprompt option is specified, then there is no interaction with the user. IMPORT A CERTIFICATE REPLY When you import a certificate reply, the certificate reply is validated with trusted certificates from the keystore, and optionally, the certificates configured in the cacerts keystore file when the -trustcacerts option is specified. The methods of determining whether the certificate reply is trusted are as follows: • If the reply is a single X.509 certificate, then the keytool command attempts to establish a trust chain, starting at the certificate reply and ending at a self-signed certificate (belonging to a root CA). The certificate reply and the hierarchy of certificates is used to authenticate the certificate reply from the new certificate chain of aliases. If a trust chain can't be established, then the certificate reply isn't imported. In this case, the keytool command doesn't print the certificate and prompt the user to verify it, because it is very difficult for a user to determine the authenticity of the certificate reply. • If the reply is a PKCS #7 formatted certificate chain or a sequence of X.509 certificates, then the chain is ordered with the user certificate first followed by zero or more CA certificates. If the chain ends with a self-signed root CA certificate and the-trustcacerts option was specified, the keytool command attempts to match it with any of the trusted certificates in the keystore or the cacerts keystore file. If the chain doesn't end with a self- signed root CA certificate and the -trustcacerts option was specified, the keytool command tries to find one from the trusted certificates in the keystore or the cacerts keystore file and add it to the end of the chain. If the certificate isn't found and the -noprompt option isn't specified, the information of the last certificate in the chain is printed, and the user is prompted to verify it. If the public key in the certificate reply matches the user's public key already stored with alias, then the old certificate chain is replaced with the new certificate chain in the reply. The old chain can only be replaced with a valid keypass, and so the password used to protect the private key of the entry is supplied. If no password is provided, and the private key password is different from the keystore password, the user is prompted for it. This command was named -import in earlier releases. This old name is still supported in this release. The new name, -importcert, is preferred. JDK 22 2024 KEYTOOL(1)
keytool - a key and certificate management utility
keytool [commands] commands Commands for keytool include the following: • -certreq: Generates a certificate request • -changealias: Changes an entry's alias • -delete: Deletes an entry • -exportcert: Exports certificate • -genkeypair: Generates a key pair • -genseckey: Generates a secret key • -gencert: Generates a certificate from a certificate request • -importcert: Imports a certificate or a certificate chain • -importpass: Imports a password • -importkeystore: Imports one or all entries from another keystore • -keypasswd: Changes the key password of an entry • -list: Lists entries in a keystore • -printcert: Prints the content of a certificate • -printcertreq: Prints the content of a certificate request • -printcrl: Prints the content of a Certificate Revocation List (CRL) file • -storepasswd: Changes the store password of a keystore • -showinfo: Displays security-related information • -version: Prints the program version See Commands and Options for a description of these commands with their options.
null
null
jmod
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 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. --dateTIMESTAMP 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 method for the syntax of glob- pattern. See the Pattern 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 JDK 22 2024 JMOD(1)
jmod - create JMOD files and list the content of existing JMOD files
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.
See Options for jmod. Required jmod-file Specifies the name of the JMOD file to create or from which to retrieve information.
null
jmap
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 JDK 22 2024 JMAP(1)
jmap - print details of a specified process
Note: This command is experimental and unsupported. jmap [options] pid
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 command.
null
jshell
JShell provides a way to interactively evaluate declarations, statements, and expressions of the Java programming language, making it easier to learn the language, explore unfamiliar code and APIs, and prototype complex code. Java statements, variable definitions, method definitions, class definitions, import statements, and expressions are accepted. The bits of code entered are called snippets. As snippets are entered, they're evaluated, and feedback is provided. Feedback varies from the results and explanations of actions to nothing, depending on the snippet entered and the feedback mode chosen. Errors are described regardless of the feedback mode. Start with the verbose mode to get the most feedback while learning the tool. Command-line options are available for configuring the initial environment when JShell is started. Within JShell, commands are available for modifying the environment as needed. Existing snippets can be loaded from a file to initialize a JShell session, or at any time within a session. Snippets can be modified within the session to try out different variations and make corrections. To keep snippets for later use, save them to a file. OPTIONS FOR JSHELL --add-exports module/package Specifies a package to be considered as exported from its defining module. --add-modules module[,module...] Specifies the root modules to resolve in addition to the initial module. -Cflag Provides a flag to pass to the compiler. To pass more than one flag, provide an instance of this option for each flag or flag argument needed. --class-path path Specifies the directories and archives that are searched to locate class files. This option overrides the path in the CLASSPATH environment variable. If the environment variable isn't set and this option isn't used, then the current directory is searched. For Linux and macOS, use a colon (:) to separate items in the path. For Windows, use a semicolon (;) to separate items. --enable-preview Allows code to depend on the preview features of this release. --execution specification Specifies an alternate execution engine, where specification is an ExecutionControl spec. See the documentation of the package jdk.jshell.spi for the syntax of the spec. --feedback mode Sets the initial level of feedback provided in response to what's entered. The initial level can be overridden within a session by using the /set feedback mode command. The default is normal. The following values are valid for mode: verbose Provides detailed feedback for entries. Additional information about the action performed is displayed after the result of the action. The next prompt is separated from the feedback by a blank line. normal Provides an average amount of feedback. The next prompt is separated from the feedback by a blank line. concise Provides minimal feedback. The next prompt immediately follows the code snippet or feedback. silent Provides no feedback. The next prompt immediately follows the code snippet. custom Provides custom feedback based on how the mode is defined. Custom feedback modes are created within JShell by using the /set mode command. --help or -h or -? Prints a summary of standard options and exits the tool. --help-extra or -X Prints a summary of nonstandard options and exits the tool. Nonstandard options are subject to change without notice. -Jflag Provides a flag to pass to the runtime system. To pass more than one flag, provide an instance of this option for each flag or flag argument needed. --module-path modulepath Specifies where to find application modules. For Linux and macOS, use a colon (:) to separate items in the path. For Windows, use a semicolon (;) to separate items. --no-startup Prevents startup scripts from running when JShell starts. Use this option to run only the scripts entered on the command line when JShell is started, or to start JShell without any preloaded information if no scripts are entered. This option can't be used if the --startup option is used. -q Sets the feedback mode to concise, which is the same as entering --feedback concise. -Rflag Provides a flag to pass to the remote runtime system. To pass more than one flag, provide an instance of this option for each flag or flag argument to pass. -s Sets the feedback mode to silent, which is the same as entering --feedback silent. --show-version Prints version information and enters the tool. --startup file Overrides the default startup script for this session. The script can contain any valid code snippets or commands. The script can be a local file or one of the following predefined scripts: DEFAULT Loads the default entries, which are commonly used as imports. JAVASE Imports all Java SE packages. PRINTING Defines print, println, and printf as jshell methods for use within the tool. TOOLING Defines javac, jar, and other methods for running JDK tools via their command-line interface within the jshell tool. For more than one script, provide a separate instance of this option for each script. Startup scripts are run when JShell is first started and when the session is restarted with the /reset, /reload, or /env command. Startup scripts are run in the order in which they're entered on the command line. This option can't be used if the --no-startup option is used. -v Sets the feedback mode to verbose, which is the same as entering --feedback verbose. --version Prints version information and exits the tool. JSHELL COMMANDS Within the jshell tool, commands are used to modify the environment and manage code snippets. /drop {name|id|startID-endID} [{name|id|startID-endID}...] Drops snippets identified by name, ID, or ID range, making them inactive. For a range of IDs, provide the starting ID and ending ID separated with a hyphen. To provide a list, separate the items in the list with a space. Use the /list command to see the IDs of code snippets. /edit [option] Opens an editor. If no option is entered, then the editor opens with the active snippets. The following options are valid: {name|id|startID-endID} [{name|id|startID-endID}...] Opens the editor with the snippets identified by name, ID, or ID range. For a range of IDs, provide the starting ID and ending ID separated with a hyphen. To provide a list, separate the items in the list with a space. Use the /list command to see the IDs of code snippets. -all Opens the editor with all snippets, including startup snippets and snippets that failed, were overwritten, or were dropped. -start Opens the editor with startup snippets that were evaluated when JShell was started. To exit edit mode, close the editor window, or respond to the prompt provided if the -wait option was used when the editor was set. Use the /set editor command to specify the editor to use. If no editor is set, then the following environment variables are checked in order: JSHELLEDITOR, VISUAL, and EDITOR. If no editor is set in JShell and none of the editor environment variables is set, then a simple default editor is used. /env [options] Displays the environment settings, or updates the environment settings and restarts the session. If no option is entered, then the current environment settings are displayed. If one or more options are entered, then the session is restarted as follows: • Updates the environment settings with the provided options. • Resets the execution state. • Runs the startup scripts. • Silently replays the history in the order entered. The history includes all valid snippets or /drop commands entered at the jshell prompt, in scripts entered on the command line, or scripts entered with the /open command. Environment settings entered on the command line or provided with a previous /reset, /env, or /reload command are maintained unless an option is entered that overwrites the setting. The following options are valid: --add-modules module[,module...] Specifies the root modules to resolve in addition to the initial module. --add-exports source-module/package=target-module[,target-module]* Adds an export of package from source-module to target- module. --class-path path Specifies the directories and archives that are searched to locate class files. This option overrides the path in the CLASSPATH environment variable. If the environment variable isn't set and this option isn't used, then the current directory is searched. For Linux and macOS, use a colon (:) to separate items in the path. For Windows, use a semicolon (;) to separate items. --module-path modulepath Specifies where to find application modules. For Linux and macOS, use a colon (:) to separate items in the path. For Windows, use a semicolon (;) to separate items. /exit [integer-expression-snippet] Exits the tool. If no snippet is entered, the exit status is zero. If a snippet is entered and the result of the snippet is an integer, the result is used as the exit status. If an error occurs, or the result of the snippet is not an integer, an error is displayed and the tool remains active. /history Displays what was entered in this session. /help [command|subject] Displays information about commands and subjects. If no options are entered, then a summary of information for all commands and a list of available subjects are displayed. If a valid command is provided, then expanded information for that command is displayed. If a valid subject is entered, then information about that subject is displayed. The following values for subject are valid: context Describes the options that are available for configuring the environment. intro Provides an introduction to the tool. shortcuts Describes keystrokes for completing commands and snippets. See Input Shortcuts. /imports Displays the current active imports, including those from the startup scripts and scripts that were entered on the command line when JShell was started. /list [option] Displays a list of snippets and their IDs. If no option is entered, then all active snippets are displayed, but startup snippets aren't. The following options are valid: {name|id|startID-endID} [{name|id|startID-endID}...] Displays the snippets identified by name, ID, or ID range. For a range of IDs, provide the starting ID and ending ID separated with a hyphen. To provide a list, separate the items in the list with a space. -all Displays all snippets, including startup snippets and snippets that failed, were overwritten, or were dropped. IDs that begin with s are startup snippets. IDs that begin with e are snippets that failed. -start Displays startup snippets that were evaluated when JShell was started. /methods [option] Displays information about the methods that were entered. If no option is entered, then the name, parameter types, and return type of all active methods are displayed. The following options are valid: {name|id|startID-endID} [{name|id|startID-endID}...] Displays information for methods identified by name, ID, or ID range. For a range of IDs, provide the starting ID and ending ID separated with a hyphen. To provide a list, separate the items in the list with a space. Use the /list command to see the IDs of code snippets. -all Displays information for all methods, including those added when JShell was started, and methods that failed, were overwritten, or were dropped. -start Displays information for startup methods that were added when JShell was started. /open file Opens the script specified and reads the snippets into the tool. The script can be a local file or one of the following predefined scripts: DEFAULT Loads the default entries, which are commonly used as imports. JAVASE Imports all Java SE packages. PRINTING Defines print, println, and printf as jshell methods for use within the tool. TOOLING Defines javac, jar, and other methods for running JDK tools via their command-line interface within the jshell tool. /reload [options] Restarts the session as follows: • Updates the environment settings with the provided options, if any. • Resets the execution state. • Runs the startup scripts. • Replays the history in the order entered. The history includes all valid snippets or /drop commands entered at the jshell prompt, in scripts entered on the command line, or scripts entered with the /open command. Environment settings entered on the command line or provided with a previous /reset, /env, or /reload command are maintained unless an option is entered that overwrites the setting. The following options are valid: --add-modules module[,module...] Specifies the root modules to resolve in addition to the initial module. --add-exports source-module/package=target-module[,target-module]* Adds an export of package from source-module to target- module. --class-path path Specifies the directories and archives that are searched to locate class files. This option overrides the path in the CLASSPATH environment variable. If the environment variable isn't set and this option isn't used, then the current directory is searched. For Linux and macOS, use a colon (:) to separate items in the path. For Windows, use a semicolon (;) to separate items. --module-path modulepath Specifies where to find application modules. For Linux and macOS, use a colon (:) to separate items in the path. For Windows, use a semicolon (;) to separate items. -quiet Replays the valid history without displaying it. Errors are displayed. -restore Resets the environment to the state at the start of the previous run of the tool or to the last time a /reset, /reload, or /env command was executed in the previous run. The valid history since that point is replayed. Use this option to restore a previous JShell session. /reset [options] Discards all entered snippets and restarts the session as follows: • Updates the environment settings with the provided options, if any. • Resets the execution state. • Runs the startup scripts. History is not replayed. All code that was entered is lost. Environment settings entered on the command line or provided with a previous /reset, /env, or /reload command are maintained unless an option is entered that overwrites the setting. The following options are valid: --add-modules module[,module...] Specifies the root modules to resolve in addition to the initial module. --add-exports source-module/package=target-module[,target-module]* Adds an export of package from source-module to target- module. --class-path path Specifies the directories and archives that are searched to locate class files. This option overrides the path in the CLASSPATH environment variable. If the environment variable isn't set and this option isn't used, then the current directory is searched. For Linux and macOS, use a colon (:) to separate items in the path. For Windows, use a semicolon (;) to separate items. --module-path modulepath Specifies where to find application modules. For Linux and macOS, use a colon (:) to separate items in the path. For Windows, use a semicolon (;) to separate items. /save [options] file Saves snippets and commands to the file specified. If no options are entered, then active snippets are saved. The following options are valid: {name|id|startID-endID} [{name|id|startID-endID}...] Saves the snippets and commands identified by name, ID, or ID range. For a range of IDs, provide the starting ID and ending ID separated with a hyphen. To provide a list, separate the items in the list with a space. Use the /list command to see the IDs of the code snippets. -all Saves all snippets, including startup snippets and snippets that were overwritten or failed. -history Saves the sequential history of all commands and snippets entered in the current session. -start Saves the current startup settings. If no startup scripts were provided, then an empty file is saved. /set [setting] Sets configuration information, including the external editor, startup settings, and feedback mode. This command is also used to create a custom feedback mode with customized prompt, format, and truncation values. If no setting is entered, then the current setting for the editor, startup settings, and feedback mode are displayed. The following values are valid for setting: editor [options] [command] Sets the command used to start an external editor when the /edit command is entered. The command can include command arguments separated by spaces. If no command or options are entered, then the current setting is displayed. The following options are valid: -default Sets the editor to the default editor provided with JShell. This option can't be used if a command for starting an editor is entered. -delete Sets the editor to the one in effect when the session started. If used with the -retain option, then the retained editor setting is deleted and the editor is set to the first of the following environment variables found: JSHELLEDITOR, VISUAL, or EDITOR. If none of the editor environment variables are set, then this option sets the editor to the default editor. This option can't be used if a command for starting an editor is entered. -retain Saves the editor setting across sessions. If no other option or a command is entered, then the current setting is saved. -wait Prompts the user to indicate when editing is complete. Otherwise control returns to JShell when the editor exits. Use this option if the editor being used exits immediately, for example, when an edit window already exists. This option is valid only when a command for starting an editor is entered. feedback [mode] Sets the feedback mode used to respond to input. If no mode is entered, then the current mode is displayed. The following modes are valid: concise, normal, silent, verbose, and any custom mode created with the /set mode command. format mode field "format-string" selector Sets the format of the feedback provided in response to input. If no mode is entered, then the current formats for all fields for all feedback modes are displayed. If only a mode is entered, then the current formats for that mode are displayed. If only a mode and field are entered, then the current formats for that field are displayed. To define a format, the following arguments are required: mode Specifies a feedback mode to which the response format is applied. Only custom modes created with the /set mode command can be modified. field Specifies a context-specific field to which the response format is applied. The fields are described in the online help, which is accessed from JShell using the /help /set format command. "format-string" Specifies the string to use as the response format for the specified field and selector. The structure of the format string is described in the online help, which is accessed from JShell using the /help /set format command. selector Specifies the context in which the response format is applied. The selectors are described in the online help, which is accessed from JShell using the /help /set format command. mode [mode-name] [existing-mode] [options] Creates a custom feedback mode with the mode name provided. If no mode name is entered, then the settings for all modes are displayed, which includes the mode, prompt, format, and truncation settings. If the name of an existing mode is provided, then the settings from the existing mode are copied to the mode being created. The following options are valid: -command|-quiet Specifies the level of feedback displayed for commands when using the mode. This option is required when creating a feedback mode. Use -command to show information and verification feedback for commands. Use -quiet to show only essential feedback for commands, such as error messages. -delete Deletes the named feedback mode for this session. The name of the mode to delete is required. To permanently delete a retained mode, use the -retain option with this option. Predefined modes can't be deleted. -retain Saves the named feedback mode across sessions. The name of the mode to retain is required. Configure the new feedback mode using the /set prompt, /set format, and /set truncation commands. To start using the new mode, use the /set feedback command. prompt mode "prompt-string" "continuation-prompt-string" Sets the prompts for input within JShell. If no mode is entered, then the current prompts for all feedback modes are displayed. If only a mode is entered, then the current prompts for that mode are displayed. To define a prompt, the following arguments are required: mode Specifies the feedback mode to which the prompts are applied. Only custom modes created with the /set mode command can be modified. "prompt-string" Specifies the string to use as the prompt for the first line of input. "continuation-prompt-string" Specifies the string to use as the prompt for the additional input lines needed to complete a snippet. start [-retain] [file [file...]|option] Sets the names of the startup scripts used when the next /reset, /reload, or /env command is entered. If more than one script is entered, then the scripts are run in the order entered. If no scripts or options are entered, then the current startup settings are displayed. The scripts can be local files or one of the following predefined scripts: DEFAULT Loads the default entries, which are commonly used as imports. JAVASE Imports all Java SE packages. PRINTING Defines print, println, and printf as jshell methods for use within the tool. TOOLING Defines javac, jar, and other methods for running JDK tools via their command-line interface within the jshell tool. The following options are valid: -default Sets the startup settings to the default settings. -none Specifies that no startup settings are used. Use the -retain option to save the start setting across sessions. truncation mode length selector Sets the maximum length of a displayed value. If no mode is entered, then the current truncation values for all feedback modes are displayed. If only a mode is entered, then the current truncation values for that mode are displayed. To define truncation values, the following arguments are required: mode Specifies the feedback mode to which the truncation value is applied. Only custom modes created with the /set mode command can be modified. length Specifies the unsigned integer to use as the maximum length for the specified selector. selector Specifies the context in which the truncation value is applied. The selectors are described in the online help, which is accessed from JShell using the /help /set truncation command. /types [option] Displays classes, interfaces, and enums that were entered. If no option is entered, then all current active classes, interfaces, and enums are displayed. The following options are valid: {name|id|startID-endID} [{name|id|startID-endID}...] Displays information for classes, interfaces, and enums identified by name, ID, or ID range. For a range of IDs, provide the starting ID and ending ID separated with a hyphen. To provide a list, separate the items in the list with a space. Use the /list command to see the IDs of the code snippets. -all Displays information for all classes, interfaces, and enums, including those added when JShell was started, and classes, interfaces, and enums that failed, were overwritten, or were dropped. -start Displays information for startup classes, interfaces, and enums that were added when JShell was started. /vars [option] Displays the name, type, and value of variables that were entered. If no option is entered, then all current active variables are displayed. The following options are valid: {name|id|startID-endID} [{name|id|startID-endID}...] Displays information for variables identified by name, ID, or ID range. For a range of IDs, provide the starting ID and ending ID separated with a hyphen. To provide a list, separate the items in the list with a space. Use the /list command to see the IDs of the code snippets. -all Displays information for all variables, including those added when JShell was started, and variables that failed, were overwritten, or were dropped. -start Displays information for startup variables that were added when JShell was started. /? Same as the /help command. /! Reruns the last snippet. /{name|id|startID-endID} [{name|id|startID-endID}...] Reruns the snippets identified by ID, range of IDs, or name. For a range of IDs, provide the starting ID and ending ID separated with a hyphen. To provide a list, separate the items in the list with a space. The first item in the list must be an ID or ID range. Use the /list command to see the IDs of the code snippets. /-n Reruns the -nth previous snippet. For example, if 15 code snippets were entered, then /-4 runs the 11th snippet. Commands aren't included in the count. INPUT SHORTCUTS The following shortcuts are available for entering commands and snippets in JShell. Tab completion <tab> When entering snippets, commands, subcommands, command arguments, or command options, use the Tab key to automatically complete the item. If the item can't be determined from what was entered, then possible options are provided. When entering a method call, use the Tab key after the method call's opening parenthesis to see the parameters for the method. If the method has more than one signature, then all signatures are displayed. Pressing the Tab key a second time displays the description of the method and the parameters for the first signature. Continue pressing the Tab key for a description of any additional signatures. Shift+<Tab> V After entering a complete expression, use this key sequence to convert the expression to a variable declaration of a type determined by the type of the expression. Shift+<Tab> M After entering a complete expression or statement, use this key sequence to convert the expression or statement to a method declaration. If an expression is entered, the return type is based on the type of the expression. Shift+<Tab> I When an identifier is entered that can't be resolved, use this key sequence to show possible imports that resolve the identifier based on the content of the specified class path. Command abbreviations An abbreviation of a command is accepted if the abbreviation uniquely identifies a command. For example, /l is recognized as the /list command. However, /s isn't a valid abbreviation because it can't be determined if the /set or /save command is meant. Use /se for the /set command or /sa for the /save command. Abbreviations are also accepted for subcommands, command arguments, and command options. For example, use /m -a to display all methods. History navigation A history of what was entered is maintained across sessions. Use the up and down arrows to scroll through commands and snippets from the current and past sessions. Use the Ctrl key with the up and down arrows to skip all but the first line of multiline snippets. History search Use the Ctrl+R key combination to search the history for the string entered. The prompt changes to show the string and the match. Ctrl+R searches backwards from the current location in the history through earlier entries. Ctrl+S searches forward from the current location in the history though later entries. INPUT EDITING The editing capabilities of JShell are similar to that of other common shells. Keyboard keys and key combinations provide line editing shortcuts. The Ctrl key and Meta key are used in key combinations. If your keyboard doesn't have a Meta key, then the Alt key is often mapped to provide Meta key functionality. Line Editing Shortcuts Key or Key Combination Action ──────────────────────────────────────────────────── Return Enter the current line. Left arrow Move the cursor to the left one character. Right arrow Move the cursor to the right one character. Ctrl+A Move the cursor to the beginning of the line. Ctrl+E Move the cursor to the end of the line. Meta+B Move the cursor to the left one word. Meta+F Move the cursor to the right one word. Delete Delete the character under the cursor. Backspace Delete the character before the cursor. Ctrl+K Delete the text from the cursor to the end of the line. Meta+D Delete the text from the cursor to the end of the word. Ctrl+W Delete the text from the cursor to the previous white space. Ctrl+Y Paste the most recently deleted text into the line. Meta+Y After Ctrl+Y, press to cycle through the previously deleted text. EXAMPLE OF STARTING AND STOPPING A JSHELL SESSION JShell is provided with the JDK. To start a session, enter jshell on the command line. A welcome message is printed, and a prompt for entering commands and snippets is provided. % jshell | Welcome to JShell -- Version 9 | For an introduction type: /help intro jshell> To see which snippets were automatically loaded when JShell started, use the /list -start command. The default startup snippets are import statements for common packages. The ID for each snippet begins with the letter s, which indicates it's a startup snippet. jshell> /list -start s1 : import java.io.*; s2 : import java.math.*; s3 : import java.net.*; s4 : import java.nio.file.*; s5 : import java.util.*; s6 : import java.util.concurrent.*; s7 : import java.util.function.*; s8 : import java.util.prefs.*; s9 : import java.util.regex.*; s10 : import java.util.stream.*; jshell> To end the session, use the /exit command. jshell> /exit | Goodbye % EXAMPLE OF ENTERING SNIPPETS Snippets are Java statements, variable definitions, method definitions, class definitions, import statements, and expressions. Terminating semicolons are automatically added to the end of a completed snippet if they're missing. The following example shows two variables and a method being defined, and the method being run. Note that a scratch variable is automatically created to hold the result because no variable was provided. jshell> int a=4 a ==> 4 jshell> int b=8 b ==> 8 jshell> int square(int i1) { ...> return i1 * i1; ...> } | created method square(int) jshell> square(b) $5 ==> 64 EXAMPLE OF CHANGING SNIPPETS Change the definition of a variable, method, or class by entering it again. The following examples shows a method being defined and the method run: jshell> String grade(int testScore) { ...> if (testScore >= 90) { ...> return "Pass"; ...> } ...> return "Fail"; ...> } | created method grade(int) jshell> grade(88) $3 ==> "Fail" To change the method grade to allow more students to pass, enter the method definition again and change the pass score to 80. Use the up arrow key to retrieve the previous entries to avoid having to reenter them and make the change in the if statement. The following example shows the new definition and reruns the method to show the new result: jshell> String grade(int testScore) { ...> if (testScore >= 80) { ...> return "Pass"; ...> } ...> return "Fail"; ...> } | modified method grade(int) jshell> grade(88) $5 ==> "Pass" For snippets that are more than a few lines long, or to make more than a few changes, use the /edit command to open the snippet in an editor. After the changes are complete, close the edit window to return control to the JShell session. The following example shows the command and the feedback provided when the edit window is closed. The /list command is used to show that the pass score was changed to 85. jshell> /edit grade | modified method grade(int) jshell> /list grade 6 : String grade(int testScore) { if (testScore >= 85) { return "Pass"; } return "Fail"; } EXAMPLE OF CREATING A CUSTOM FEEDBACK MODE The feedback mode determines the prompt that's displayed, the feedback messages that are provided as snippets are entered, and the maximum length of a displayed value. Predefined feedback modes are provided. Commands for creating custom feedback modes are also provided. Use the /set mode command to create a new feedback mode. In the following example, the new mode mymode, is based on the predefined feedback mode, normal, and verifying command feedback is displayed: jshell> /set mode mymode normal -command | Created new feedback mode: mymode Because the new mode is based on the normal mode, the prompts are the same. The following example shows how to see what prompts are used and then changes the prompts to custom strings. The first string represents the standard JShell prompt. The second string represents the prompt for additional lines in multiline snippets. jshell> /set prompt mymode | /set prompt mymode "\njshell> " " ...> " jshell> /set prompt mymode "\nprompt$ " " continue$ " The maximum length of a displayed value is controlled by the truncation setting. Different types of values can have different lengths. The following example sets an overall truncation value of 72, and a truncation value of 500 for variable value expressions: jshell> /set truncation mymode 72 jshell> /set truncation mymode 500 varvalue The feedback displayed after snippets are entered is controlled by the format setting and is based on the type of snippet entered and the action taken for that snippet. In the predefined mode normal, the string created is displayed when a method is created. The following example shows how to change that string to defined: jshell> /set format mymode action "defined" added-primary Use the /set feedback command to start using the feedback mode that was just created. The following example shows the custom mode in use: jshell> /set feedback mymode | Feedback mode: mymode prompt$ int square (int num1){ continue$ return num1*num1; continue$ } | defined method square(int) prompt$ JDK 22 2024 JSHELL(1)
jshell - interactively evaluate declarations, statements, and expressions of the Java programming language in a read-eval-print loop (REPL)
jshell [options] [load-files]
Command-line options, separated by spaces. See Options for jshell. load-files One or more scripts to run when the tool is started. Scripts can contain any valid code snippets or JShell commands. The script can be a local file or one of following predefined scripts: DEFAULT Loads the default entries, which are commonly used as imports. JAVASE Imports all Java SE packages. PRINTING Defines print, println, and printf as jshell methods for use within the tool. TOOLING Defines javac, jar, and other methods for running JDK tools via their command-line interface within the jshell tool. For more than one script, use a space to separate the names. Scripts are run in the order in which they're entered on the command line. Command-line scripts are run after startup scripts. To run a script after JShell is started, use the /open command. To accept input from standard input and suppress the interactive I/O, enter a hyphen (-) for load-files. This option enables the use of the jshell tool in pipe chains.
null
jstat
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. -JjavaOption 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. 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.
jstat - monitor JVM statistics
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.
null
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 JDK 22 2024 JSTAT(1)
jlink
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 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 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 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 Strips debug information from the output image. Plugin generate-cds-archive 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 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 JDK 22 2024 JLINK(1)
jlink - assemble and optimize a set of modules and their dependencies into a custom runtime image
jlink [options] --module-path modulepath --add-modules module [, module...]
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. --compress={0|1|2}[:filter=pattern-list] --include-locales=langtag[,langtag]* --order-resources=pattern-list --strip-debug --generate-cds-archive
null
serialver
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 (:). -Joption 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 JDK 22 2024 SERIALVER(1)
serialver - return the serialVersionUID for one or more classes in a form suitable for copying into an evolving class
serialver [options] [classnames]
This represents the command-line options for the serialver command. See Options for serialver. classnames The classes for which serialVersionUID is to be returned.
null
javadoc
The javadoc tool parses the declarations and documentation comments in a set of Java source files and produces corresponding HTML pages that describe (by default) the public and protected classes, nested and implicitly declared classes (but not anonymous inner classes), interfaces, constructors, methods, and fields. You can use the javadoc tool to generate the API documentation or the implementation documentation for a set of source files. You can run the javadoc tool on entire packages, individual source files, or both. When documenting entire packages, you can use the -subpackages option either to recursively traverse a directory and its subdirectories, or to pass in an explicit list of package names. When you document individual source files, pass in a list of Java source file names. Conformance The Standard Doclet does not validate the content of documentation comments for conformance, nor does it attempt to correct any errors in documentation comments. Anyone running javadoc is advised to be aware of the problems that may arise when generating non-conformant output or output containing executable content, such as JavaScript. The Standard Doclet does provide the DocLint feature to help developers detect common problems in documentation comments; but it is also recommended to check the generated output with any appropriate conformance and other checking tools. For more details on the conformance requirements for HTML5 documents, see Conformance requirements [https://www.w3.org/TR/html5/infrastructure.html#conformance- requirements] in the HTML5 Specification. For more details on security issues related to web pages, see the Open Web Application Security Project (OWASP) [https://www.owasp.org] page.
javadoc - generate HTML pages of API documentation from Java source files
javadoc [options] [packagenames] [sourcefiles] [@files]
Specifies command-line options, separated by spaces. See Standard javadoc Options, Extra javadoc Options, Standard Options for the Standard Doclet, and Extra Options for the Standard Doclet. packagenames Specifies names of packages that you want to document, separated by spaces, for example java.lang java.lang.reflect java.awt. If you want to also document the subpackages, then use the -subpackages option to specify the packages. By default, javadoc looks for the specified packages in the current directory and subdirectories. Use the -sourcepath option to specify the list of directories where to look for packages. sourcefiles Specifies names of Java source files that you want to document, separated by spaces, for example Class.java Object.java Button.java. By default, javadoc looks for the specified classes in the current directory. However, you can specify the full path to the class file and use wildcard characters, for example /home/src/java/awt/Graphics*.java. You can also specify the path relative to the current directory. @files Specifies names of files that contain a list of javadoc tool options, package names, and source file names in any order. javadoc supports command-line options for both the main javadoc tool and the currently selected doclet. The Standard Doclet is used if no other doclet is specified. GNU-style options (that is, those beginning with --) can use an equal sign (=) instead of whitespace characters to separate the name of an option from its value. Standard javadoc Options The following core javadoc options are equivalent to corresponding javac options. See Standard Options in javac for the detailed descriptions of using these options: • --add-modules • -bootclasspath • --class-path, -classpath, or -cp • --enable-preview • -encoding • -extdirs • --limit-modules • --module • --module-path or -p • --module-source-path • --release • --source or -source • --source-path or -sourcepath • --system • --upgrade-module-path The following options are the core javadoc options that are not equivalent to a corresponding javac option: -breakiterator Computes the first sentence with BreakIterator. The first sentence is copied to the package, class, or member summary and to the alphabetic index. The BreakIterator class is used to determine the end of a sentence for all languages except for English. • English default sentence-break algorithm --- Stops at a period followed by a space or an HTML block tag, such as <P>. • Breakiterator sentence-break algorithm --- Stops at a period, question mark, or exclamation point followed by a space when the next word starts with a capital letter. This is meant to handle most abbreviations (such as "The serial no. is valid", but will not handle "Mr. Smith"). The -breakiterator option doesn't stop at HTML tags or sentences that begin with numbers or symbols. The algorithm stops at the last period in ../filename, even when embedded in an HTML tag. -doclet class Generates output by using an alternate doclet. Use the fully qualified name. This doclet defines the content and formats the output. If the -doclet option isn't used, then the javadoc tool uses the standard doclet for generating the default HTML format. This class must contain the start(Root) method. The path to this starting class is defined by the -docletpath option. -docletpath path Specifies where to find doclet class files (specified with the -doclet option) and any JAR files it depends on. If the starting class file is in a JAR file, then this option specifies the path to that JAR file. You can specify an absolute path or a path relative to the current directory. If classpathlist contains multiple paths or JAR files, then they should be separated with a colon (:) on Linux and a semi-colon (;) on Windows. This option isn't necessary when the doclet starting class is already in the search path. -exclude pkglist Unconditionally, excludes the specified packages and their subpackages from the list formed by -subpackages. It excludes those packages even when they would otherwise be included by some earlier or later -subpackages option. The following example would include java.io, java.util, and java.math (among others), but would exclude packages rooted at java.net and java.lang. Notice that these examples exclude java.lang.ref, which is a subpackage of java.lang. • Linux and macOS: javadoc -sourcepath /home/user/src -subpackages java -exclude java.net:java.lang • Windows: javadoc -sourcepath \user\src -subpackages java -exclude java.net:java.lang --expand-requires value Instructs the javadoc tool to expand the set of modules to be documented. By default, only the modules given explicitly on the command line are documented. Supports the following values: • transitive: additionally includes all the required transitive dependencies of those modules. • all: includes all dependencies. --help, -help, -h, or -? Prints a synopsis of the standard options. --help-extra or -X Prints a synopsis of the set of extra options. -Jflag Passes flag directly to the Java Runtime Environment (JRE) that runs the javadoc tool. For example, if you must ensure that the system sets aside 32 MB of memory in which to process the generated documentation, then you would call the -Xmx option as follows: javadoc -J-Xmx32m -J-Xms32m com.mypackage. Be aware that -Xms is optional because it only sets the size of initial memory, which is useful when you know the minimum amount of memory required. There is no space between the J and the flag. Use the -version option to report the version of the JRE being used to run the javadoc tool. javadoc -J-version java version "17" 2021-09-14 LTS Java(TM) SE Runtime Environment (build 17+35-LTS-2724) Java HotSpot(TM) 64-Bit Server VM (build 17+35-LTS-2724, mixed mode, sharing) -locale name Specifies the locale that the javadoc tool uses when it generates documentation. The argument is the name of the locale, as described in java.util.Locale documentation, such as en_US (English, United States) or en_US_WIN (Windows variant). Specifying a locale causes the javadoc tool to choose the resource files of that locale for messages such as strings in the navigation bar, headings for lists and tables, help file contents, comments in the stylesheet.css file, and so on. It also specifies the sorting order for lists sorted alphabetically, and the sentence separator to determine the end of the first sentence. The -locale option doesn't determine the locale of the documentation comment text specified in the source files of the documented classes. -package Shows only package, protected, and public classes and members. -private Shows all classes and members. -protected Shows only protected and public classes and members. This is the default. -public Shows only the public classes and members. -quiet Shuts off messages so that only the warnings and errors appear to make them easier to view. It also suppresses the version string. --show-members value Specifies which members (fields or methods) are documented, where value can be any of the following: • public --- shows only public members • protected --- shows public and protected members; this is the default • package --- shows public, protected, and package members • private --- shows all members --show-module-contents value Specifies the documentation granularity of module declarations, where value can be api or all. --show-packages value Specifies which modules packages are documented, where value can be exported or all packages. --show-types value Specifies which types (classes, interfaces, etc.) are documented, where value can be any of the following: • public --- shows only public types • protected --- shows public and protected types; this is the default • package --- shows public, protected, and package types • private --- shows all types -subpackages subpkglist Generates documentation from source files in the specified packages and recursively in their subpackages. This option is useful when adding new subpackages to the source code because they are automatically included. Each package argument is any top-level subpackage (such as java) or fully qualified package (such as javax.swing) that doesn't need to contain source files. Arguments are separated by colons on all operating systems. Wild cards aren't allowed. Use -sourcepath to specify where to find the packages. This option doesn't process source files that are in the source tree but don't belong to the packages. For example, the following commands generates documentation for packages named java and javax.swing and all of their subpackages. • Linux and macOS: javadoc -d docs -sourcepath /home/user/src -subpackages java:javax.swing • Windows: javadoc -d docs -sourcepath \user\src -subpackages java:javax.swing -verbose Provides more detailed messages while the javadoc tool runs. Without the -verbose option, messages appear for loading the source files, generating the documentation (one message per source file), and sorting. The -verbose option causes the printing of additional messages that specify the number of milliseconds to parse each Java source file. --version Prints version information. -Werror Reports an error if any warnings occur. Note that if a Java source file contains an implicitly declared class, then that class and its public, protected, and package members will be documented regardless of the options such as --show-types, --show-members, -private, -protected, -package, and -public. If --show-members is specified with value private or if -private is used then all private members of an implicitly declared class will be documented too. Extra javadoc Options Note: The additional options for javadoc are subject to change without notice. The following additional javadoc options are equivalent to corresponding javac options. See Extra Options in javac for the detailed descriptions of using these options: • --add-exports • --add-reads • --patch-module • -Xmaxerrs • -Xmaxwarns Standard Options for the Standard Doclet The following options are provided by the standard doclet. --add-script file Adds file as an additional JavaScript file to the generated documentation. This option can be used one or more times to specify additional script files. Command-line example: javadoc --add-script first_script.js --add-script second_script.js pkg_foo --add-stylesheet file Adds file as an additional stylesheet file to the generated documentation. This option can be used one or more times to specify additional stylesheets included in the documentation. Command-line example: javadoc --add-stylesheet new_stylesheet_1.css --add-stylesheet new_stylesheet_2.css pkg_foo --allow-script-in-comments Allow JavaScript in options and comments. -author Includes the @author text in the generated docs. -bottom html-code Specifies the text to be placed at the bottom of each output file. The text is placed at the bottom of the page, underneath the lower navigation bar. The text can contain HTML tags and white space, but when it does, the text must be enclosed in quotation marks. Use escape characters for any internal quotation marks within text. -charset name Specifies the HTML character set for this document. The name should be a preferred MIME name as specified in the IANA Registry, Character Sets [http://www.iana.org/assignments/character-sets]. For example: javadoc -charset "iso-8859-1" mypackage This command inserts the following line in the head of every generated page: <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> The meta tag is described in the HTML standard (4197265 and 4137321), HTML Document Representation [http://www.w3.org/TR/REC-html40/charset.html#h-5.2.2]. -d directory Specifies the destination directory where the javadoc tool saves the generated HTML files. If you omit the -d option, then the files are saved to the current directory. The directory value can be absolute or relative to the current working directory. The destination directory is automatically created when the javadoc tool runs. • Linux and macOS: For example, the following command generates the documentation for the package com.mypackage and saves the results in the /user/doc/ directory: javadoc -d /user/doc/ com.mypackage • Windows: For example, the following command generates the documentation for the package com.mypackage and saves the results in the \user\doc\ directory: javadoc -d \user\doc\ com.mypackage -docencoding name Specifies the encoding of the generated HTML files. The name should be a preferred MIME name as specified in the IANA Registry, Character Sets [http://www.iana.org/assignments/character-sets]. Three options are available for use in a javadoc encoding command. The -encoding option is used for encoding the files read by the javadoc tool, while the -docencoding and -charset options are used for encoding the files written by the tool. Of the three available options, at most, only the input and an output encoding option are used in a single encoding command. If you specify both input and output encoding options in a command, they must be the same value. If you specify neither output option, it defaults to the input encoding. For example: javadoc -docencoding "iso-8859-1" mypackage -docfilessubdirs Recursively copies doc-file subdirectories. Enables deep copying of doc-files directories. Subdirectories and all contents are recursively copied to the destination. For example, the directory doc-files/example/images and all of its contents are copied. The -excludedocfilessubdir option can be used to exclude specific subdirectories. -doctitle html-code Specifies the title to place near the top of the overview summary file. The text specified in the title tag is placed as a centered, level-one heading directly beneath the top navigation bar. The title tag can contain HTML tags and white space, but when it does, you must enclose the title in quotation marks. Additional quotation marks within the title tag must be escaped. For example, javadoc -doctitle "<b>My Library</b><br>v1.0" com.mypackage. -excludedocfilessubdir name1,name2... Excludes any subdirectories with the given names when recursively copying doc-file subdirectories. See -docfilessubdirs. For historical reasons, : can be used anywhere in the argument as a separator instead of ,. -footer html-code Specifies the footer text to be placed at the bottom of each output file. Thehtml-code value is placed to the right of the lower navigation bar. The html-code value can contain HTML tags and white space, but when it does, the html-code value must be enclosed in quotation marks. Use escape characters for any internal quotation marks within a footer. -group name p1,p2... Group the specified packages together in the Overview page. For historical reasons, : can be used as a separator anywhere in the argument instead of ,. -header html-code Specifies the header text to be placed at the top of each output file. The header is placed to the right of the upper navigation bar. The header can contain HTML tags and white space, but when it does, the header must be enclosed in quotation marks. Use escape characters for internal quotation marks within a header. For example, javadoc -header "<b>My Library</b><br>v1.0" com.mypackage. -helpfile filename Includes the file that links to the HELP link in the top and bottom navigation bars . Without this option, the javadoc tool creates a help file help-doc.html that is hard-coded in the javadoc tool. This option lets you override the default. The filename can be any name and isn't restricted to help-doc.html. The javadoc tool adjusts the links in the navigation bar accordingly. For example: • Linux and macOS: javadoc -helpfile /home/user/myhelp.html java.awt • Windows: javadoc -helpfile C:\user\myhelp.html java.awt -html5 This option is a no-op and is just retained for backwards compatibility. --javafx or -javafx Enables JavaFX functionality. This option is enabled by default if the JavaFX library classes are detected on the module path. -keywords Adds HTML keyword <meta> tags to the generated file for each class. These tags can help search engines that look for <meta> tags find the pages. Most search engines that search the entire Internet don't look at <meta> tags, because pages can misuse them. Search engines offered by companies that confine their searches to their own website can benefit by looking at <meta> tags. The <meta> tags include the fully qualified name of the class and the unqualified names of the fields and methods. Constructors aren't included because they are identical to the class name. For example, the class String starts with these keywords: <meta name="keywords" content="java.lang.String class"> <meta name="keywords" content="CASE_INSENSITIVE_ORDER"> <meta name="keywords" content="length()"> <meta name="keywords" content="charAt()"> -link url Creates links to existing javadoc generated documentation of externally referenced classes. The url argument is the absolute or relative URL of the directory that contains the external javadoc generated documentation. You can specify multiple -link options in a specified javadoc tool run to link to multiple documents. Either a package-list or an element-list file must be in this url directory (otherwise, use the -linkoffline option). Note: The package-list and element-list files are generated by the javadoc tool when generating the API documentation and should not be modified by the user. When you use the javadoc tool to document packages, it uses the package-list file to determine the packages declared in an API. When you generate API documents for modules, the javadoc tool uses the element-list file to determine the modules and packages declared in an API. The javadoc tool reads the names from the appropriate list file and then links to the packages or modules at that URL. When the javadoc tool runs, the url value is copied into the <A HREF> links that are created. Therefore, url must be the URL to the directory and not to a file. You can use an absolute link for url to enable your documents to link to a document on any web site, or you can use a relative link to link only to a relative location. If you use a relative link, then the value you pass in should be the relative path from the destination directory (specified with the -d option) to the directory containing the packages being linked to. When you specify an absolute link, you usually use an HTTP link. However, if you want to link to a file system that has no web server, then you can use a file link. Use a file link only when everyone who wants to access the generated documentation shares the same file system. In all cases, and on all operating systems, use a slash as the separator, whether the URL is absolute or relative, and https:, http:, or file: as specified in the URL Memo: Uniform Resource Locators [http://www.ietf.org/rfc/rfc1738.txt]. -link https://<host>/<directory>/<directory>/.../<name> -link http://<host>/<directory>/<directory>/.../<name> -link file://<host>/<directory>/<directory>/.../<name> -link <directory>/<directory>/.../<name> --link-modularity-mismatch (warn|info) Specifies whether external documentation with wrong modularity (e.g. non-modular documentation for a modular library, or the reverse case) should be reported as a warning (warn) or just a message (info). The default behavior is to report a warning. -linkoffline url1 url2 This option is a variation of the -link option. They both create links to javadoc generated documentation for externally referenced classes. You can specify multiple -linkoffline options in a specified javadoc tool run. Use the -linkoffline option when: • Linking to a document on the web that the javadoc tool can't access through a web connection • The package-list or element-list file of the external document either isn't accessible or doesn't exist at the URL location, but does exist at a different location and can be specified by either the package-list or element-list file (typically local). Note: The package-list and element-list files are generated by the javadoc tool when generating the API documentation and should not be modified by the user. If url1 is accessible only on the World Wide Web, then the -linkoffline option removes the constraint that the javadoc tool must have a web connection to generate documentation. Another use of the -linkoffline option is as a work-around to update documents. After you have run the javadoc tool on a full set of packages or modules, you can run the javadoc tool again on a smaller set of changed packages or modules, so that the updated files can be inserted back into the original set. For example, the -linkoffline option takes two arguments. The first is for the string to be embedded in the <a href> links, and the second tells the javadoc tool where to find either the package-list or element-list file. The url1 or url2 value is the absolute or relative URL of the directory that contains the external javadoc generated documentation that you want to link to. When relative, the value should be the relative path from the destination directory (specified with the -d option) to the root of the packages being linked to. See url in the -link option. --link-platform-properties url Specifies a properties file used to configure links to platform documentation. The url argument is expected to point to a properties file containing one or more entries with the following format, where <version> is the platform version as passed to the --release or --source option and <url> is the base URL of the corresponding platform API documentation: doclet.platform.docs.<version>=<url> For instance, a properties file containing URLs for releases 15 to 17 might contain the following lines: doclet.platform.docs.15=https://example.com/api/15/ doclet.platform.docs.16=https://example.com/api/16/ doclet.platform.docs.17=https://example.com/api/17/ If the properties file does not contain an entry for a particular release no platform links are generated. -linksource Creates an HTML version of each source file (with line numbers) and adds links to them from the standard HTML documentation. Links are created for classes, interfaces, constructors, methods, and fields whose declarations are in a source file. Otherwise, links aren't created, such as for default constructors and generated classes. This option exposes all private implementation details in the included source files, including private classes, private fields, and the bodies of private methods, regardless of the -public, -package, -protected, and -private options. Unless you also use the -private option, not all private classes or interfaces are accessible through links. Each link appears on the name of the identifier in its declaration. For example, the link to the source code of the Button class would be on the word Button: public class Button extends Component implements Accessible The link to the source code of the getLabel method in the Button class is on the word getLabel: public String getLabel() --main-stylesheet file or -stylesheetfile file Specifies the path of an alternate stylesheet file that contains the definitions for the CSS styles used in the generated documentation. This option lets you override the default. If you do not specify the option, the javadoc tool will create and use a default stylesheet. The file name can be any name and isn't restricted to stylesheet.css. The --main-stylesheet option is the preferred form. Command-line example: javadoc --main-stylesheet main_stylesheet.css pkg_foo -nocomment Suppresses the entire comment body, including the main description and all tags, and generate only declarations. This option lets you reuse source files that were originally intended for a different purpose so that you can produce skeleton HTML documentation during the early stages of a new project. -nodeprecated Prevents the generation of any deprecated API in the documentation. This does what the -nodeprecatedlist option does, and it doesn't generate any deprecated API throughout the rest of the documentation. This is useful when writing code when you don't want to be distracted by the deprecated code. -nodeprecatedlist Prevents the generation of the file that contains the list of deprecated APIs (deprecated-list.html) and the link in the navigation bar to that page. The javadoc tool continues to generate the deprecated API throughout the rest of the document. This is useful when your source code contains no deprecated APIs, and you want to make the navigation bar cleaner. -nohelp Omits the HELP link in the navigation bar at the top of each page of output. -noindex Omits the index from the generated documents. The index is produced by default. -nonavbar Prevents the generation of the navigation bar, header, and footer, that are usually found at the top and bottom of the generated pages. The -nonavbar option has no effect on the -bottom option. The -nonavbar option is useful when you are interested only in the content and have no need for navigation, such as when you are converting the files to PostScript or PDF for printing only. --no-platform-links Prevents the generation of links to platform documentation. These links are generated by default. -noqualifier name1,name2... Excludes the list of qualifiers from the output. The package name is removed from places where class or interface names appear. For historical reasons, : can be used anywhere in the argument as a separator instead of ,. The following example omits all package qualifiers: -noqualifier all. The following example omits java.lang and java.io package qualifiers: -noqualifier java.lang:java.io. The following example omits package qualifiers starting with java and com.sun subpackages, but not javax: -noqualifier java.*:com.sun.*. Where a package qualifier would appear due to the previous behavior, the name can be suitably shortened. This rule is in effect whether or not the -noqualifier option is used. -nosince Omits from the generated documents the Since sections associated with the @since tags. -notimestamp Suppresses the time stamp, which is hidden in an HTML comment in the generated HTML near the top of each page. The -notimestamp option is useful when you want to run the javadoc tool on two source bases and get the differences between diff them, because it prevents time stamps from causing a diff (which would otherwise be a diff on every page). The time stamp includes the javadoc tool release number. -notree Omits the class and interface hierarchy pages from the generated documents. These are the pages you reach using the Tree button in the navigation bar. The hierarchy is produced by default. --override-methods (detail|summary) Documents overridden methods in the detail or summary sections. The default is detail. -overview filename Specifies that the javadoc tool should retrieve the text for the overview documentation from the source file specified by filename and place it on the Overview page (overview-summary.html). A relative path specified with the file name is relative to the current working directory. While you can use any name you want for the filename value and place it anywhere you want for the path, it is typical to name it overview.html and place it in the source tree at the directory that contains the topmost package directories. In this location, no path is needed when documenting packages, because the -sourcepath option points to this file. • Linux and macOS: For example, if the source tree for the java.lang package is src/classes/java/lang/, then you could place the overview file at src/classes/overview.html. • Windows: For example, if the source tree for the java.lang package is src\classes\java\lang\, then you could place the overview file at src\classes\overview.html The overview page is created only when you pass two or more package names to the javadoc tool. The title on the overview page is set by -doctitle. -serialwarn Generates compile-time warnings for missing @serial tags. By default, Javadoc generates no serial warnings. Use this option to display the serial warnings, which helps to properly document default serializable fields and writeExternal methods. --since release(,release)* Generates documentation for APIs that were added or newly deprecated in the specified releases. If the @since tag in the javadoc comment of an element in the documented source code matches a release passed as option argument, information about the element and the release it was added in is included in a "New API" page. If the "Deprecated API" page is generated and the since element of the java.lang.Deprecated annotation of a documented element matches a release in the option arguments, information about the release the element was deprecated in is added to the "Deprecated API" page. Releases are compared using case-sensitive string comparison. --since-label text Specifies the text to use in the heading of the "New API" page. This may contain information about the releases covered in the page, e.g. "New API in release 2.0", or "New API since release 1". --snippet-path snippetpathlist Specifies the search paths for finding files for external snippets. The snippetpathlist can contain multiple paths by separating them with the platform path separator (; on Windows; : on other platforms.) The Standard Doclet first searches the snippet-files subdirectory in the package containing the snippet, and then searches all the directories in the given list. -sourcetab tab-length Specifies the number of spaces each tab uses in the source. --spec-base-url url Specifies the base URL for relative URLs in @spec tags, to be used when generating links to any external specifications. It can either be an absolute URL, or a relative URL, in which case it is evaluated relative to the base directory of the generated output files. The default value is equivalent to {@docRoot}/../specs. -splitindex Splits the index file into multiple files, alphabetically, one file per letter, plus a file for any index entries that start with non-alphabetical symbols. -tag name:locations:header Specifies single argument custom tags. For the javadoc tool to spell-check tag names, it is important to include a -tag option for every custom tag that is present in the source code, disabling (with X) those that aren't being output in the current run. The colon (:) is always the separator. To include a colon in the tag name, escape it with a backward slash (\). The -tag option outputs the tag heading, header, in bold, followed on the next line by the text from its single argument. Similar to any block tag, the argument text can contain inline tags, which are also interpreted. The output is similar to standard one- argument tags, such as the @return and @author tags. Omitting a header value causes the name to be the heading. locations is a list of characters specifying the kinds of declarations in which the tag may be used. The following characters may be used, in either uppercase or lowercase: • A: all declarations • C: constructors • F: fields • M: methods • O: the overview page and other documentation files in doc-files subdirectories • P: packages • S: modules • T: types (classes and interfaces) • X: nowhere: the tag is disabled, and will be ignored The order in which tags are given on the command line will be used as the order in which the tags appear in the generated output. You can include standard tags in the order given on the command line by using the -tag option with no locations or header. -taglet class Specifies the fully qualified name of the taglet used in generating the documentation for that tag. Use the fully qualified name for the class value. This taglet also defines the number of text arguments that the custom tag has. The taglet accepts those arguments, processes them, and generates the output. Taglets are useful for block or inline tags. They can have any number of arguments and implement custom behavior, such as making text bold, formatting bullets, writing out the text to a file, or starting other processes. Taglets can only determine where a tag should appear and in what form. All other decisions are made by the doclet. A taglet can't do things such as remove a class name from the list of included classes. However, it can execute side effects, such as printing the tag's text to a file or triggering another process. Use the -tagletpath option to specify the path to the taglet. The following example inserts the To Do taglet after Parameters and ahead of Throws in the generated pages. -taglet com.sun.tools.doclets.ToDoTaglet -tagletpath /home/taglets -tag return -tag param -tag todo -tag throws -tag see Alternately, you can use the -taglet option in place of its -tag option, but that might be difficult to read. -tagletpath tagletpathlist Specifies the search paths for finding taglet class files. The tagletpathlist can contain multiple paths by separating them with the platform path separator (; on Windows; : on other platforms.) The javadoc tool searches all subdirectories of the specified paths. -top html-code Specifies the text to be placed at the top of each output file. -use Creates class and package usage pages. Includes one Use page for each documented class and package. The page describes what packages, classes, methods, constructors and fields use any API of the specified class or package. Given class C, things that use class C would include subclasses of C, fields declared as C, methods that return C, and methods and constructors with parameters of type C. For example, you can look at the Use page for the String type. Because the getName method in the java.awt.Font class returns type String, the getName method uses String and so the getName method appears on the Use page for String. This documents only uses of the API, not the implementation. When a method uses String in its implementation, but doesn't take a string as an argument or return a string, that isn't considered a use of String.To access the generated Use page, go to the class or package and click the Use link in the navigation bar. -version Includes the version text in the generated docs. This text is omitted by default. To find out what version of the javadoc tool you are using, use the -J-version option. -windowtitle title Specifies the title to be placed in the HTML <title> tag. The text specified in the title tag appears in the window title and in any browser bookmarks (favorite places) that someone creates for this page. This title should not contain any HTML tags because a browser will not interpret them correctly. Use escape characters on any internal quotation marks within the title tag. If the -windowtitle option is omitted, then the javadoc tool uses the value of the -doctitle option for the -windowtitle option. For example, javadoc -windowtitle "My Library" com.mypackage. Extra Options for the Standard Doclet The following are additional options provided by the Standard Doclet and are subject to change without notice. Additional options are less commonly used or are otherwise regarded as advanced. --date date-and-time Specifies the value to be used to timestamp the generated pages, in ISO 8601 [https://www.iso.org/iso-8601-date-and-time- format.html] format. The specified value must be within 10 years of the current date and time. It is an error to specify both -notimestamp and --date. Using a specific value means the generated documentation can be part of a reproducible build [https://reproducible-builds.org/]. If the option is not given, the default value is the current date and time. For example: javadoc --date 2022-02-01T17:41:59-08:00 mypackage --legal-notices (default|none|directory) Specifies the location from which to copy legal files to the generated documentation. If the option is not specified or is used with the value default, the files are copied from the default location. If the argument is used with value none, no files are copied. Every other argument is interpreted as directory from which to copy the legal files. --no-frames This option is a no-op and is just retained for backwards compatibility. -Xdoclint Enables recommended checks for problems in documentation comments. By default, the -Xdoclint option is enabled. Disable it with the option -Xdoclint:none. For more details, see DocLint. -Xdoclint:flag,flag,... Enable or disable specific checks for different kinds of issues in documentation comments. Each flag can be one of all, none, or [-]group where group has one of the following values: accessibility, html, missing, reference, syntax. For more details on these values, see DocLint Groups. When specifying two or more flags, you can either use a single -Xdoclint:... option, listing all the desired flags, or you can use multiple options giving one or more flag in each option. For example, use either of the following commands to check for the HTML, syntax, and accessibility issues in the file MyFile.java. javadoc -Xdoclint:html -Xdoclint:syntax -Xdoclint:accessibility MyFile.java javadoc -Xdoclint:html,syntax,accessibility MyFile.java The following examples illustrate how to change what DocLint reports: • -Xdoclint:none --- disables all checks • -Xdoclint:group --- enables group checks • -Xdoclint:all --- enables all groups of checks • -Xdoclint:all,-group --- enables all checks except group checks For more details, see DocLint. -Xdoclint/package:[-]packages Enables or disables checks in specific packages. packages is a comma separated list of package specifiers. A package specifier is either a qualified name of a package or a package name prefix followed by *, which expands to all subpackages of the given package. Prefix the package specifier with - to disable checks for the specified packages. For more details, see DocLint. -Xdocrootparent url Replaces all @docRoot items followed by /.. in documentation comments with url. DOCLINT DocLint provides the ability to check for possible problems in documentation comments. Problems may be reported as warnings or errors, depending on their severity. For example, a missing comment may be bad style that deserves a warning, but a link to an unknown Java declaration is more serious and deserves an error. Problems are organized into groups, and options can be used to enable or disable messages in one or more groups. Within the source code, messages in one or more groups can be suppressed by using @SuppressWarnings annotations. When invoked from javadoc, by default DocLint checks all comments that are used in the generated documentation. It thus relies on other command-line options to determine which declarations, and which corresponding documentation comments will be included. Note: this may mean that even comments on some private members of serializable classes will also be checked, if the members need to be documented in the generated Serialized Forms page. In contrast, when DocLint is invoked from javac, DocLint solely relies on the various -Xdoclint... options to determine which documentation comments to check. DocLint doesn't attempt to fix invalid input, it just reports it. Note: DocLint doesn't guarantee the completeness of these checks. In particular, it isn't a full HTML compliance checker. The goal is to just report common errors in a convenient manner. Groups The checks performed by DocLint are organized into groups. The warnings and errors in each group can be enabled or disabled with command-line options, or suppressed with @SuppressWarnings annotations. The groups are as follows: • accessibility --- Checks for issues related to accessibility. For example, no alt attribute specified in an <img> element, or no caption or summary attributes specified in a <table> element. Issues are reported as errors if a downstream validation tool might be expected to report an error in the files generated by javadoc. For reference, see the Web Content Accessibility Guidelines [https://www.w3.org/WAI/standards-guidelines/wcag/]. • html --- Detects common high-level HTML issues. For example, putting block elements inside inline elements, or not closing elements that require an end tag. Issues are reported as errors if a downstream validation tool might be expected to report an error in the files generated by javadoc. For reference, see the HTML Living Standard [https://html.spec.whatwg.org/multipage/]. • missing --- Checks for missing documentation comments or tags. For example, a missing comment on a class declaration, or a missing @param or @return tag in the comment for a method declaration. Issues related to missing items are typically reported as warnings because they are unlikely to be reported as errors by downstream validation tools that may be used to check the output generated by javadoc. • reference --- Checks for issues relating to the references to Java API elements from documentation comment tags. For example, the reference in @see or {@link ...} cannot be found, or a bad name is given for @param or @throws. Issues are typically reported as errors because while the issue may not cause problems in the generated files, the author has likely made a mistake that will lead to incorrect or unexpected documentation. • syntax --- Checks for low-level syntactic issues in documentation comments. For example, unescaped angle brackets (< and >) and ampersands (&) and invalid documentation comment tags. Issues are typically reported as errors because the issues may lead to incorrect or unexpected documentation. Suppressing Messages DocLint checks for and recognizes two strings that may be present in the arguments for an @SuppressWarnings annotation. • doclint • doclint:LIST where LIST is a comma-separated list of one or more of accessibility, html, missing, syntax, reference. The names in LIST are the same group names supported by the command- line -Xdoclint option for javac and javadoc. (This is the same convention honored by the javac -Xlint option and the corresponding names supported by @SuppressWarnings.) The names in LIST can equivalently be specified in separate arguments of the annotation. For example, the following are equivalent: • @SuppressWarnings("doclint:accessibility,missing") • @SuppressWarnings("doclint:accessibility", "doclint:missing") When DocLint detects an issue in a documentation comment, it checks for the presence of @SuppressWarnings on the associated declaration and on all lexically enclosing declarations. The issue will be ignored if any such annotation is found containing the simple string doclint or the longer form doclint:LIST where LIST contains the name of the group for the issue. Note: as with other uses of @SuppressWarnings, using the annotation on a module or package declaration only affects that declaration; it does not affect the contents of the module or package in other source files. All messages related to an issue are suppressed by the presence of an appropriate @SuppressWarnings annotation: this includes errors as well as warnings. Note: It is only possible to suppress messages. If an annotation of @SuppressWarnings("doclint") is given on a top-level declaration, all DocLint messages for that declaration and any enclosed declarations will be suppressed; it is not possible to selectively re-enable messages for issues in enclosed declarations. Comparison with downstream validation tools DocLint is a utility built into javac and javadoc that checks the content of documentation comments, as found in source files. In contrast, downstream validation tools can be used to validate the output generated from those documentation comments by javadoc and the Standard Doclet. Although there is some overlap in functionality, the two mechanisms are different and each has its own strengths and weaknesses. • Downstream validation tools can check the end result of any generated documentation, as it will be seen by the end user. This includes content from all sources, including documentation comments, the Standard Doclet itself, user-provided taglets, and content supplied via command-line options. Because such tools are analyzing complete HTML pages, they can do more complete checks than can DocLint. However, when a problem is found in the generated pages, it can be harder to track down exactly where in the build pipeline the problem needs to be fixed. • DocLint checks the content of documentation comments, in source files. This makes it very easy to identify the exact position of any issues that may be found. DocLint can also detect some semantic errors in documentation comments that downstream tools cannot detect, such as missing comments, using an @return tag in a method returning void, or an @param tag describing a non-existent parameter. But by its nature, DocLint cannot report on problems such as missing links, or errors in user-provided custom taglets, or problems in the Standard Doclet itself. It also cannot reliably detect errors in documentation comments at the boundaries between content in a documentation comment and content generated by a custom taglet. JDK 22 2024 JAVADOC(1)
null
jinfo
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. JDK 22 2024 JINFO(1)
jinfo - generate Java configuration information for a specified Java process
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 command.
null
null
jstatd
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. -Joption 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. 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.
jstatd - monitor the creation and termination of instrumented Java HotSpot VMs
Note: This command is experimental and unsupported. jstatd [options]
This represents the jstatd command-line options. See Options for the jstatd Command.
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 JDK 22 2024 JSTATD(1)
jdeps
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 jdepscommand 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 JDK 22 2024 JDEPS(1)
jdeps - launch the Java class dependency analyzer
jdeps [options] path ...
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.
null
jconsole
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. JDK 22 2024 JCONSOLE(1)
jconsole - start a graphical console to monitor and manage Java applications
jconsole [-interval=n] [-notile] [-plugin path] [-version] [connection ... ] [-Jinput_arguments] jconsole -help
-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. -Jinput_arguments Passes input_arguments to the JVM on which the jconsole command is run. -help or --help Displays the help message for the command.
null
jpackage
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. --type or -t type 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. --app-version version Version of the application and/or package --copyright copyright Copyright for the application --description description Description of the application --help or -h Print the usage text with a list and description of each valid option for the current platform to the output stream, and exit. --icon path Path of the icon of the application package (absolute path or relative to the current directory) --name or -n name Name of the application and/or package --dest or -d destination Path where generated output file is placed (absolute path or relative to the current directory). Defaults to the current working directory. --temp directory 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. --vendor vendor Vendor of the application --verbose Enables verbose output. --version Print the product version to the output stream and exit. Options for creating the runtime image: --add-modules module-name [,module-name...] 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. --module-path or -p module-path [,module-path...] 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. --jlink-options options 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. --runtime-image directory 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: --input or -i directory 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. `--app-content additional-content[,additional-content...] 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): --add-launcher name=path 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", "app-version", "icon", "launcher- as-service", "win-console", "win-shortcut", "win-menu", "linux- app-category", 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. --arguments arguments 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. --java-options options Options to pass to the Java runtime This option can be used multiple times. --main-class class-name Qualified name of the application main class to execute This option can only be used if --main-jar is specified. --main-jar main-jar 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. --module or -m module-name[/main-class] 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 option for creating the application launcher: Windows platform options (available only when running on Windows): --win-console 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): --mac-package-identifier identifier 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. --mac-package-name name 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. --mac-package-signing-prefix prefix 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. --mac-sign Request that the package or the predefined application image be signed. --mac-signing-keychain keychain-name Name of the keychain to search for the signing identity If not specified, the standard keychains are used. --mac-signing-key-user-name name Team or user name portion in Apple signing identities --mac-app-store Indicates that the jpackage output is intended for the Mac App Store. --mac-entitlements path Path to file containing entitlements to use when signing executables and libraries in the bundle --mac-app-category category String used to construct LSApplicationCategoryType in application plist The default value is "utilities". Options for creating the application package: --about-url url URL of the application's home page --app-image directory 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) --file-associations path 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. --install-dir path 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) --license-file path Path to the license file (absolute path or relative to the current directory) --resource-dir path 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. --runtime-image path Path of the predefined runtime image to install (absolute path or relative to the current directory) Option is required when creating a runtime installer. --launcher-as-service 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): --win-dir-chooser Adds a dialog to enable the user to choose a directory in which the product is installed. --win-help-url url URL where user can obtain further information or technical support --win-menu Request to add a Start Menu shortcut for this application --win-menu-group menu-group-name Start Menu group this application is placed in --win-per-user-install Request to perform an install on a per-user basis --win-shortcut Request to create a desktop shortcut for this application --win-shortcut-prompt Adds a dialog to enable the user to choose if shortcuts will be created by installer --win-update-url url URL of available application update information --win-upgrade-uuid id UUID associated with upgrades for this package Linux platform options (available only when running on Linux): --linux-package-name name Name for Linux package Defaults to the application name. --linux-deb-maintainer email-address Maintainer for .deb bundle --linux-menu-group menu-group-name Menu group this application is placed in --linux-package-deps Required packages or capabilities for the application --linux-rpm-license-type type Type of the license ("License: value" of the RPM .spec) --linux-app-release release Release value of the RPM <name>.spec file or Debian revision value of the DEB control file --linux-app-category category-value Group value of the RPM /.spec file or Section value of DEB control file --linux-shortcut Creates a shortcut for the application. macOS platform options (available only when running on macOS): '--mac-dmg-content additional-content[,additional-content...] 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 JDK 22 2024 JPACKAGE(1)
jpackage - tool for packaging self-contained Java applications.
jpackage [options]
Command-line options separated by spaces. See jpackage Options.
null
jimage
null
null
null
null
null
valet
null
null
null
null
null
yaml-lint
null
null
null
null
null
vapor
null
null
null
null
null
carbon
null
null
null
null
null
var-dump-server
null
null
null
null
null
laravel-zero
null
null
null
null
null
jp.php
null
null
null
null
null
expose
null
null
null
null
null
laravel
null
null
null
null
null
datasets-cli
null
null
null
null
null
cpan
This script provides a command interface (not a shell) to CPAN. At the moment it uses CPAN.pm to do the work, but it is not a one-shot command runner for CPAN.pm.
cpan - easily interact with CPAN from the command line
# with arguments and no switches, installs specified modules cpan module_name [ module_name ... ] # with switches, installs modules with extra behavior cpan [-cfFimtTw] module_name [ module_name ... ] # use local::lib cpan -I module_name [ module_name ... ] # one time mirror override for faster mirrors cpan -p ... # with just the dot, install from the distribution in the # current directory cpan . # without arguments, starts CPAN.pm shell cpan # without arguments, but some switches cpan [-ahpruvACDLOPX]
-a Creates a CPAN.pm autobundle with CPAN::Shell->autobundle. -A module [ module ... ] Shows the primary maintainers for the specified modules. -c module Runs a `make clean` in the specified module's directories. -C module [ module ... ] Show the Changes files for the specified modules -D module [ module ... ] Show the module details. This prints one line for each out-of-date module (meaning, modules locally installed but have newer versions on CPAN). Each line has three columns: module name, local version, and CPAN version. -f Force the specified action, when it normally would have failed. Use this to install a module even if its tests fail. When you use this option, -i is not optional for installing a module when you need to force it: % cpan -f -i Module::Foo -F Turn off CPAN.pm's attempts to lock anything. You should be careful with this since you might end up with multiple scripts trying to muck in the same directory. This isn't so much of a concern if you're loading a special config with "-j", and that config sets up its own work directories. -g module [ module ... ] Downloads to the current directory the latest distribution of the module. -G module [ module ... ] UNIMPLEMENTED Download to the current directory the latest distribution of the modules, unpack each distribution, and create a git repository for each distribution. If you want this feature, check out Yanick Champoux's "Git::CPAN::Patch" distribution. -h Print a help message and exit. When you specify "-h", it ignores all of the other options and arguments. -i module [ module ... ] Install the specified modules. With no other switches, this switch is implied. -I Load "local::lib" (think like "-I" for loading lib paths). Too bad "-l" was already taken. -j Config.pm Load the file that has the CPAN configuration data. This should have the same format as the standard CPAN/Config.pm file, which defines $CPAN::Config as an anonymous hash. -J Dump the configuration in the same format that CPAN.pm uses. This is useful for checking the configuration as well as using the dump as a starting point for a new, custom configuration. -l List all installed modules with their versions -L author [ author ... ] List the modules by the specified authors. -m Make the specified modules. -M mirror1,mirror2,... A comma-separated list of mirrors to use for just this run. The "-P" option can find them for you automatically. -n Do a dry run, but don't actually install anything. (unimplemented) -O Show the out-of-date modules. -p Ping the configured mirrors and print a report -P Find the best mirrors you could be using and use them for the current session. -r Recompiles dynamically loaded modules with CPAN::Shell->recompile. -s Drop in the CPAN.pm shell. This command does this automatically if you don't specify any arguments. -t module [ module ... ] Run a `make test` on the specified modules. -T Do not test modules. Simply install them. -u Upgrade all installed modules. Blindly doing this can really break things, so keep a backup. -v Print the script version and CPAN.pm version then exit. -V Print detailed information about the cpan client. -w UNIMPLEMENTED Turn on cpan warnings. This checks various things, like directory permissions, and tells you about problems you might have. -x module [ module ... ] Find close matches to the named modules that you think you might have mistyped. This requires the optional installation of Text::Levenshtein or Text::Levenshtein::Damerau. -X Dump all the namespaces to standard output.
# print a help message cpan -h # print the version numbers cpan -v # create an autobundle cpan -a # recompile modules cpan -r # upgrade all installed modules cpan -u # install modules ( sole -i is optional ) cpan -i Netscape::Booksmarks Business::ISBN # force install modules ( must use -i ) cpan -fi CGI::Minimal URI # install modules but without testing them cpan -Ti CGI::Minimal URI Environment variables There are several components in CPAN.pm that use environment variables. The build tools, ExtUtils::MakeMaker and Module::Build use some, while others matter to the levels above them. Some of these are specified by the Perl Toolchain Gang: Lancaster Consensus: <https://github.com/Perl-Toolchain-Gang/toolchain-site/blob/master/lancaster-consensus.md> Oslo Consensus: <https://github.com/Perl-Toolchain-Gang/toolchain-site/blob/master/oslo-consensus.md> NONINTERACTIVE_TESTING Assume no one is paying attention and skips prompts for distributions that do that correctly. cpan(1) sets this to 1 unless it already has a value (even if that value is false). PERL_MM_USE_DEFAULT Use the default answer for a prompted questions. cpan(1) sets this to 1 unless it already has a value (even if that value is false). CPAN_OPTS As with "PERL5OPT", a string of additional cpan(1) options to add to those you specify on the command line. CPANSCRIPT_LOGLEVEL The log level to use, with either the embedded, minimal logger or Log::Log4perl if it is installed. Possible values are the same as the "Log::Log4perl" levels: "TRACE", "DEBUG", "INFO", "WARN", "ERROR", and "FATAL". The default is "INFO". GIT_COMMAND The path to the "git" binary to use for the Git features. The default is "/usr/local/bin/git". EXIT VALUES The script exits with zero if it thinks that everything worked, or a positive number if it thinks that something failed. Note, however, that in some cases it has to divine a failure by the output of things it does not control. For now, the exit codes are vague: 1 An unknown error 2 The was an external problem 4 There was an internal problem with the script 8 A module failed to install TO DO * one shot configuration values from the command line BUGS * none noted SEE ALSO Most behaviour, including environment variables and configuration, comes directly from CPAN.pm. SOURCE AVAILABILITY This code is in Github in the CPAN.pm repository: https://github.com/andk/cpanpm The source used to be tracked separately in another GitHub repo, but the canonical source is now in the above repo. CREDITS Japheth Cleaver added the bits to allow a forced install (-f). Jim Brandt suggest and provided the initial implementation for the up- to-date and Changes features. Adam Kennedy pointed out that exit() causes problems on Windows where this script ends up with a .bat extension AUTHOR brian d foy, "<bdfoy@cpan.org>" COPYRIGHT Copyright (c) 2001-2015, brian d foy, All Rights Reserved. You may redistribute this under the same terms as Perl itself. perl v5.38.2 2023-11-28 CPAN(1)
rubberband
null
null
null
null
null
wheel3.11
null
null
null
null
null
lzmainfo
lzmainfo shows information stored in the .lzma file header. It reads the first 13 bytes from the specified file, decodes the header, and prints it to standard output in human readable format. If no files are given or file is -, standard input is read. Usually the most interesting information is the uncompressed size and the dictionary size. Uncompressed size can be shown only if the file is in the non-streamed .lzma format variant. The amount of memory required to decompress the file is a few dozen kilobytes plus the dictionary size. lzmainfo is included in XZ Utils primarily for backward compatibility with LZMA Utils. EXIT STATUS 0 All is good. 1 An error occurred. BUGS lzmainfo uses MB while the correct suffix would be MiB (2^20 bytes). This is to keep the output compatible with LZMA Utils. SEE ALSO xz(1) Tukaani 2013-06-30 LZMAINFO(1)
lzmainfo - show information stored in the .lzma file header
lzmainfo [--help] [--version] [file...]
null
null
valet
null
null
null
null
null
p7sign
null
null
null
null
null
md5sum
Print or check MD5 (128-bit) checksums. With no FILE, or when FILE is -, read standard input. -b, --binary read in binary mode -c, --check read checksums from the FILEs and check them --tag create a BSD-style checksum -t, --text read in text mode (default) -z, --zero end each output line with NUL, not newline, and disable file name escaping The following five options are useful only when verifying checksums: --ignore-missing don't fail or report status for missing files --quiet don't print OK for each successfully verified file --status don't output anything, status code shows success --strict exit non-zero for improperly formatted checksum lines -w, --warn warn about improperly formatted checksum lines --help display this help and exit --version output version information and exit The sums are computed as described in RFC 1321. When checking, the input should be a former output of this program. The default mode is to print a line with: checksum, a space, a character indicating input mode ('*' for binary, ' ' for text or where binary is insignificant), and name for each FILE. Note: There is no difference between binary mode and text mode on GNU systems. BUGS Do not use the MD5 algorithm for security related purposes. Instead, use an SHA-2 algorithm, implemented in the programs sha224sum(1), sha256sum(1), sha384sum(1), sha512sum(1), or the BLAKE2 algorithm, implemented in b2sum(1) AUTHOR Written by Ulrich Drepper, Scott Miller, and David Madore. REPORTING BUGS GNU coreutils online help: <https://www.gnu.org/software/coreutils/> Report any translation bugs to <https://translationproject.org/team/> COPYRIGHT Copyright © 2023 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. SEE ALSO cksum(1) Full documentation <https://www.gnu.org/software/coreutils/md5sum> or available locally via: info '(coreutils) md5sum invocation' GNU coreutils 9.3 April 2023 MD5SUM(1)
md5sum - compute and check MD5 message digest
md5sum [OPTION]... [FILE]...
null
null
git-lfs
Git LFS is a system for managing and versioning large files in association with a Git repository. Instead of storing the large files within the Git repository as blobs, Git LFS stores special "pointer files" in the repository, while storing the actual file contents on a Git LFS server. The contents of the large file are downloaded automatically when needed, for example when a Git branch containing the large file is checked out. Git LFS works by using a "smudge" filter to look up the large file contents based on the pointer file, and a "clean" filter to create a new version of the pointer file when the large file’s contents change. It also uses a pre-push hook to upload the large file contents to the Git LFS server whenever a commit containing a new large file version is about to be pushed to the corresponding Git server. COMMANDS Like Git, Git LFS commands are separated into high level ("porcelain") commands and low level ("plumbing") commands. High level porcelain commands git-lfs-checkout(1) Populate working copy with real content from Git LFS files. git-lfs-completion(1) Generate shell scripts for command-line tab-completion of Git LFS commands. git-lfs-dedup(1) De-duplicate Git LFS files. git-lfs-env(1) Display the Git LFS environment. git-lfs-ext(1) Display Git LFS extension details. git-lfs-fetch(1) Download Git LFS files from a remote. git-lfs-fsck(1) Check Git LFS files for consistency. git-lfs-install(1) Install Git LFS configuration. git-lfs-lock(1) Set a file as "locked" on the Git LFS server. git-lfs-locks(1) List currently "locked" files from the Git LFS server. git-lfs-logs(1) Show errors from the Git LFS command. git-lfs-ls-files(1) Show information about Git LFS files in the index and working tree. git-lfs-migrate(1) Migrate history to or from Git LFS git-lfs-prune(1) Delete old Git LFS files from local storage git-lfs-pull(1) Fetch Git LFS changes from the remote & checkout any required working tree files. git-lfs-push(1) Push queued large files to the Git LFS endpoint. git-lfs-status(1) Show the status of Git LFS files in the working tree. git-lfs-track(1) View or add Git LFS paths to Git attributes. git-lfs-uninstall(1) Uninstall Git LFS by removing hooks and smudge/clean filter configuration. git-lfs-unlock(1) Remove "locked" setting for a file on the Git LFS server. git-lfs-untrack(1) Remove Git LFS paths from Git Attributes. git-lfs-update(1) Update Git hooks for the current Git repository. git-lfs-version(1) Report the version number. Low level plumbing commands git-lfs-clean(1) Git clean filter that converts large files to pointers. git-lfs-filter-process(1) Git process filter that converts between large files and pointers. git-lfs-merge-driver(1) Merge text-based LFS files git-lfs-pointer(1) Build and compare pointers. git-lfs-post-checkout(1) Git post-checkout hook implementation. git-lfs-post-commit(1) Git post-commit hook implementation. git-lfs-post-merge(1) Git post-merge hook implementation. git-lfs-pre-push(1) Git pre-push hook implementation. git-lfs-smudge(1) Git smudge filter that converts pointer in blobs to the actual content. git-lfs-standalone-file(1) Git LFS standalone transfer adapter for file URLs (local paths).
git-lfs - Work with large files in Git repositories
git lfs <command> [<args>]
null
To get started with Git LFS, the following commands can be used. 1. Setup Git LFS on your system. You only have to do this once per user account: git lfs install 2. Choose the type of files you want to track, for examples all ISO images, with git-lfs-track(1): git lfs track "*.iso" 3. The above stores this information in gitattributes(5) files, so that file needs to be added to the repository: git add .gitattributes 4. Commit, push and work with the files normally: git add file.iso git commit -m "Add disk image" git push GIT-LFS(1)
unzstd
zstd is a fast lossless compression algorithm and data compression tool, with command line syntax similar to gzip(1) and xz(1). It is based on the LZ77 family, with further FSE & huff0 entropy stages. zstd offers highly configurable compression speed, from fast modes at > 200 MB/s per core, to strong modes with excellent compression ratios. It also features a very fast decoder, with speeds > 500 MB/s per core, which remains roughly stable at all compression settings. zstd command line syntax is generally similar to gzip, but features the following few differences: • Source files are preserved by default. It´s possible to remove them automatically by using the --rm command. • When compressing a single file, zstd displays progress notifications and result summary by default. Use -q to turn them off. • zstd displays a short help page when command line is an error. Use -q to turn it off. • zstd does not accept input from console, though it does accept stdin when it´s not the console. • zstd does not store the input´s filename or attributes, only its contents. zstd processes each file according to the selected operation mode. If no files are given or file is -, zstd reads from standard input and writes the processed data to standard output. zstd will refuse to write compressed data to standard output if it is a terminal: it will display an error message and skip the file. Similarly, zstd will refuse to read compressed data from standard input if it is a terminal. Unless --stdout or -o is specified, files are written to a new file whose name is derived from the source file name: • When compressing, the suffix .zst is appended to the source filename to get the target filename. • When decompressing, the .zst suffix is removed from the source filename to get the target filename Concatenation with .zst Files It is possible to concatenate multiple .zst files. zstd will decompress such agglomerated file as if it was a single .zst file.
zstd - zstd, zstdmt, unzstd, zstdcat - Compress or decompress .zst files
zstd [OPTIONS] [-|INPUT-FILE] [-o OUTPUT-FILE] zstdmt is equivalent to zstd -T0 unzstd is equivalent to zstd -d zstdcat is equivalent to zstd -dcf
Integer Suffixes and Special Values In most places where an integer argument is expected, an optional suffix is supported to easily indicate large integers. There must be no space between the integer and the suffix. KiB Multiply the integer by 1,024 (2^10). Ki, K, and KB are accepted as synonyms for KiB. MiB Multiply the integer by 1,048,576 (2^20). Mi, M, and MB are accepted as synonyms for MiB. Operation Mode If multiple operation mode options are given, the last one takes effect. -z, --compress Compress. This is the default operation mode when no operation mode option is specified and no other operation mode is implied from the command name (for example, unzstd implies --decompress). -d, --decompress, --uncompress Decompress. -t, --test Test the integrity of compressed files. This option is equivalent to --decompress --stdout > /dev/null, decompressed data is discarded and checksummed for errors. No files are created or removed. -b# Benchmark file(s) using compression level #. See BENCHMARK below for a description of this operation. --train FILES Use FILES as a training set to create a dictionary. The training set should contain a lot of small files (> 100). See DICTIONARY BUILDER below for a description of this operation. -l, --list Display information related to a zstd compressed file, such as size, ratio, and checksum. Some of these fields may not be available. This command´s output can be augmented with the -v modifier. Operation Modifiers • -#: selects # compression level [1-19] (default: 3). Higher compression levels generally produce higher compression ratio at the expense of speed and memory. A rough rule of thumb is that compression speed is expected to be divided by 2 every 2 levels. Technically, each level is mapped to a set of advanced parameters (that can also be modified individually, see below). Because the compressor´s behavior highly depends on the content to compress, there´s no guarantee of a smooth progression from one level to another. • --ultra: unlocks high compression levels 20+ (maximum 22), using a lot more memory. Note that decompression will also require more memory when using these levels. • --fast[=#]: switch to ultra-fast compression levels. If =# is not present, it defaults to 1. The higher the value, the faster the compression speed, at the cost of some compression ratio. This setting overwrites compression level if one was set previously. Similarly, if a compression level is set after --fast, it overrides it. • -T#, --threads=#: Compress using # working threads (default: 1). If # is 0, attempt to detect and use the number of physical CPU cores. In all cases, the nb of threads is capped to ZSTDMT_NBWORKERS_MAX, which is either 64 in 32-bit mode, or 256 for 64-bit environments. This modifier does nothing if zstd is compiled without multithread support. • --single-thread: Use a single thread for both I/O and compression. As compression is serialized with I/O, this can be slightly slower. Single-thread mode features significantly lower memory usage, which can be useful for systems with limited amount of memory, such as 32-bit systems. Note 1: this mode is the only available one when multithread support is disabled. Note 2: this mode is different from -T1, which spawns 1 compression thread in parallel with I/O. Final compressed result is also slightly different from -T1. • --auto-threads={physical,logical} (default: physical): When using a default amount of threads via -T0, choose the default based on the number of detected physical or logical cores. • --adapt[=min=#,max=#]: zstd will dynamically adapt compression level to perceived I/O conditions. Compression level adaptation can be observed live by using command -v. Adaptation can be constrained between supplied min and max levels. The feature works when combined with multi-threading and --long mode. It does not work with --single-thread. It sets window size to 8 MiB by default (can be changed manually, see wlog). Due to the chaotic nature of dynamic adaptation, compressed result is not reproducible. Note: at the time of this writing, --adapt can remain stuck at low speed when combined with multiple worker threads (>=2). • --long[=#]: enables long distance matching with # windowLog, if # is not present it defaults to 27. This increases the window size (windowLog) and memory usage for both the compressor and decompressor. This setting is designed to improve the compression ratio for files with long matches at a large distance. Note: If windowLog is set to larger than 27, --long=windowLog or --memory=windowSize needs to be passed to the decompressor. • -D DICT: use DICT as Dictionary to compress or decompress FILE(s) • --patch-from FILE: Specify the file to be used as a reference point for zstd´s diff engine. This is effectively dictionary compression with some convenient parameter selection, namely that windowSize > srcSize. Note: cannot use both this and -D together. Note: --long mode will be automatically activated if chainLog < fileLog (fileLog being the windowLog required to cover the whole file). You can also manually force it. Note: for all levels, you can use --patch-from in --single-thread mode to improve compression ratio at the cost of speed. Note: for level 19, you can get increased compression ratio at the cost of speed by specifying --zstd=targetLength= to be something large (i.e. 4096), and by setting a large --zstd=chainLog=. • --rsyncable: zstd will periodically synchronize the compression state to make the compressed file more rsync-friendly. There is a negligible impact to compression ratio, and a potential impact to compression speed, perceptible at higher speeds, for example when combining --rsyncable with many parallel worker threads. This feature does not work with --single-thread. You probably don´t want to use it with long range mode, since it will decrease the effectiveness of the synchronization points, but your mileage may vary. • -C, --[no-]check: add integrity check computed from uncompressed data (default: enabled) • --[no-]content-size: enable / disable whether or not the original size of the file is placed in the header of the compressed file. The default option is --content-size (meaning that the original size will be placed in the header). • --no-dictID: do not store dictionary ID within frame header (dictionary compression). The decoder will have to rely on implicit knowledge about which dictionary to use, it won´t be able to check if it´s correct. • -M#, --memory=#: Set a memory usage limit. By default, zstd uses 128 MiB for decompression as the maximum amount of memory the decompressor is allowed to use, but you can override this manually if need be in either direction (i.e. you can increase or decrease it). This is also used during compression when using with --patch-from=. In this case, this parameter overrides that maximum size allowed for a dictionary. (128 MiB). Additionally, this can be used to limit memory for dictionary training. This parameter overrides the default limit of 2 GiB. zstd will load training samples up to the memory limit and ignore the rest. • --stream-size=#: Sets the pledged source size of input coming from a stream. This value must be exact, as it will be included in the produced frame header. Incorrect stream sizes will cause an error. This information will be used to better optimize compression parameters, resulting in better and potentially faster compression, especially for smaller source sizes. • --size-hint=#: When handling input from a stream, zstd must guess how large the source size will be when optimizing compression parameters. If the stream size is relatively small, this guess may be a poor one, resulting in a higher compression ratio than expected. This feature allows for controlling the guess when needed. Exact guesses result in better compression ratios. Overestimates result in slightly degraded compression ratios, while underestimates may result in significant degradation. • --target-compressed-block-size=#: Attempt to produce compressed blocks of approximately this size. This will split larger blocks in order to approach this target. This feature is notably useful for improved latency, when the receiver can leverage receiving early incomplete data. This parameter defines a loose target: compressed blocks will target this size "on average", but individual blocks can still be larger or smaller. Enabling this feature can decrease compression speed by up to ~10% at level 1. Higher levels will see smaller relative speed regression, becoming invisible at higher settings. • -f, --force: disable input and output checks. Allows overwriting existing files, input from console, output to stdout, operating on links, block devices, etc. During decompression and when the output destination is stdout, pass-through unrecognized formats as-is. • -c, --stdout: write to standard output (even if it is the console); keep original files (disable --rm). • -o FILE: save result into FILE. Note that this operation is in conflict with -c. If both operations are present on the command line, the last expressed one wins. • --[no-]sparse: enable / disable sparse FS support, to make files with many zeroes smaller on disk. Creating sparse files may save disk space and speed up decompression by reducing the amount of disk I/O. default: enabled when output is into a file, and disabled when output is stdout. This setting overrides default and can force sparse mode over stdout. • --[no-]pass-through enable / disable passing through uncompressed files as-is. During decompression when pass-through is enabled, unrecognized formats will be copied as-is from the input to the output. By default, pass-through will occur when the output destination is stdout and the force (-f) option is set. • --rm: remove source file(s) after successful compression or decompression. This command is silently ignored if output is stdout. If used in combination with -o, triggers a confirmation prompt (which can be silenced with -f), as this is a destructive operation. • -k, --keep: keep source file(s) after successful compression or decompression. This is the default behavior. • -r: operate recursively on directories. It selects all files in the named directory and all its subdirectories. This can be useful both to reduce command line typing, and to circumvent shell expansion limitations, when there are a lot of files and naming breaks the maximum size of a command line. • --filelist FILE read a list of files to process as content from FILE. Format is compatible with ls output, with one file per line. • --output-dir-flat DIR: resulting files are stored into target DIR directory, instead of same directory as origin file. Be aware that this command can introduce name collision issues, if multiple files, from different directories, end up having the same name. Collision resolution ensures first file with a given name will be present in DIR, while in combination with -f, the last file will be present instead. • --output-dir-mirror DIR: similar to --output-dir-flat, the output files are stored underneath target DIR directory, but this option will replicate input directory hierarchy into output DIR. If input directory contains "..", the files in this directory will be ignored. If input directory is an absolute directory (i.e. "/var/tmp/abc"), it will be stored into the "output-dir/var/tmp/abc". If there are multiple input files or directories, name collision resolution will follow the same rules as --output-dir-flat. • --format=FORMAT: compress and decompress in other formats. If compiled with support, zstd can compress to or decompress from other compression algorithm formats. Possibly available options are zstd, gzip, xz, lzma, and lz4. If no such format is provided, zstd is the default. • -h/-H, --help: display help/long help and exit • -V, --version: display version number and immediately exit. note that, since it exits, flags specified after -V are effectively ignored. Advanced: -vV also displays supported formats. -vvV also displays POSIX support. -qV will only display the version number, suitable for machine reading. • -v, --verbose: verbose mode, display more information • -q, --quiet: suppress warnings, interactivity, and notifications. specify twice to suppress errors too. • --no-progress: do not display the progress bar, but keep all other messages. • --show-default-cparams: shows the default compression parameters that will be used for a particular input file, based on the provided compression level and the input size. If the provided file is not a regular file (e.g. a pipe), this flag will output the parameters used for inputs of unknown size. • --exclude-compressed: only compress files that are not already compressed. • --: All arguments after -- are treated as files gzip Operation Modifiers When invoked via a gzip symlink, zstd will support further options that intend to mimic the gzip behavior: -n, --no-name do not store the original filename and timestamps when compressing a file. This is the default behavior and hence a no-op. --best alias to the option -9. Environment Variables Employing environment variables to set parameters has security implications. Therefore, this avenue is intentionally limited. Only ZSTD_CLEVEL and ZSTD_NBTHREADS are currently supported. They set the default compression level and number of threads to use during compression, respectively. ZSTD_CLEVEL can be used to set the level between 1 and 19 (the "normal" range). If the value of ZSTD_CLEVEL is not a valid integer, it will be ignored with a warning message. ZSTD_CLEVEL just replaces the default compression level (3). ZSTD_NBTHREADS can be used to set the number of threads zstd will attempt to use during compression. If the value of ZSTD_NBTHREADS is not a valid unsigned integer, it will be ignored with a warning message. ZSTD_NBTHREADS has a default value of (1), and is capped at ZSTDMT_NBWORKERS_MAX==200. zstd must be compiled with multithread support for this variable to have any effect. They can both be overridden by corresponding command line arguments: -# for compression level and -T# for number of compression threads. ADVANCED COMPRESSION OPTIONS zstd provides 22 predefined regular compression levels plus the fast levels. A compression level is translated internally into multiple advanced parameters that control the behavior of the compressor (one can observe the result of this translation with --show-default-cparams). These advanced parameters can be overridden using advanced compression options. --zstd[=options]: The options are provided as a comma-separated list. You may specify only the options you want to change and the rest will be taken from the selected or default compression level. The list of available options: strategy=strat, strat=strat Specify a strategy used by a match finder. There are 9 strategies numbered from 1 to 9, from fastest to strongest: 1=ZSTD_fast, 2=ZSTD_dfast, 3=ZSTD_greedy, 4=ZSTD_lazy, 5=ZSTD_lazy2, 6=ZSTD_btlazy2, 7=ZSTD_btopt, 8=ZSTD_btultra, 9=ZSTD_btultra2. windowLog=wlog, wlog=wlog Specify the maximum number of bits for a match distance. The higher number of increases the chance to find a match which usually improves compression ratio. It also increases memory requirements for the compressor and decompressor. The minimum wlog is 10 (1 KiB) and the maximum is 30 (1 GiB) on 32-bit platforms and 31 (2 GiB) on 64-bit platforms. Note: If windowLog is set to larger than 27, --long=windowLog or --memory=windowSize needs to be passed to the decompressor. hashLog=hlog, hlog=hlog Specify the maximum number of bits for a hash table. Bigger hash tables cause fewer collisions which usually makes compression faster, but requires more memory during compression. The minimum hlog is 6 (64 entries / 256 B) and the maximum is 30 (1B entries / 4 GiB). chainLog=clog, clog=clog Specify the maximum number of bits for the secondary search structure, whose form depends on the selected strategy. Higher numbers of bits increases the chance to find a match which usually improves compression ratio. It also slows down compression speed and increases memory requirements for compression. This option is ignored for the ZSTD_fast strategy, which only has the primary hash table. The minimum clog is 6 (64 entries / 256 B) and the maximum is 29 (512M entries / 2 GiB) on 32-bit platforms and 30 (1B entries / 4 GiB) on 64-bit platforms. searchLog=slog, slog=slog Specify the maximum number of searches in a hash chain or a binary tree using logarithmic scale. More searches increases the chance to find a match which usually increases compression ratio but decreases compression speed. The minimum slog is 1 and the maximum is ´windowLog´ - 1. minMatch=mml, mml=mml Specify the minimum searched length of a match in a hash table. Larger search lengths usually decrease compression ratio but improve decompression speed. The minimum mml is 3 and the maximum is 7. targetLength=tlen, tlen=tlen The impact of this field vary depending on selected strategy. For ZSTD_btopt, ZSTD_btultra and ZSTD_btultra2, it specifies the minimum match length that causes match finder to stop searching. A larger targetLength usually improves compression ratio but decreases compression speed. For ZSTD_fast, it triggers ultra-fast mode when > 0. The value represents the amount of data skipped between match sampling. Impact is reversed: a larger targetLength increases compression speed but decreases compression ratio. For all other strategies, this field has no impact. The minimum tlen is 0 and the maximum is 128 KiB. overlapLog=ovlog, ovlog=ovlog Determine overlapSize, amount of data reloaded from previous job. This parameter is only available when multithreading is enabled. Reloading more data improves compression ratio, but decreases speed. The minimum ovlog is 0, and the maximum is 9. 1 means "no overlap", hence completely independent jobs. 9 means "full overlap", meaning up to windowSize is reloaded from previous job. Reducing ovlog by 1 reduces the reloaded amount by a factor 2. For example, 8 means "windowSize/2", and 6 means "windowSize/8". Value 0 is special and means "default": ovlog is automatically determined by zstd. In which case, ovlog will range from 6 to 9, depending on selected strat. ldmHashLog=lhlog, lhlog=lhlog Specify the maximum size for a hash table used for long distance matching. This option is ignored unless long distance matching is enabled. Bigger hash tables usually improve compression ratio at the expense of more memory during compression and a decrease in compression speed. The minimum lhlog is 6 and the maximum is 30 (default: 20). ldmMinMatch=lmml, lmml=lmml Specify the minimum searched length of a match for long distance matching. This option is ignored unless long distance matching is enabled. Larger/very small values usually decrease compression ratio. The minimum lmml is 4 and the maximum is 4096 (default: 64). ldmBucketSizeLog=lblog, lblog=lblog Specify the size of each bucket for the hash table used for long distance matching. This option is ignored unless long distance matching is enabled. Larger bucket sizes improve collision resolution but decrease compression speed. The minimum lblog is 1 and the maximum is 8 (default: 3). ldmHashRateLog=lhrlog, lhrlog=lhrlog Specify the frequency of inserting entries into the long distance matching hash table. This option is ignored unless long distance matching is enabled. Larger values will improve compression speed. Deviating far from the default value will likely result in a decrease in compression ratio. The default value is wlog - lhlog. Example The following parameters sets advanced compression options to something similar to predefined level 19 for files bigger than 256 KB: --zstd=wlog=23,clog=23,hlog=22,slog=6,mml=3,tlen=48,strat=6 -B#: Specify the size of each compression job. This parameter is only available when multi-threading is enabled. Each compression job is run in parallel, so this value indirectly impacts the nb of active threads. Default job size varies depending on compression level (generally 4 * windowSize). -B# makes it possible to manually select a custom size. Note that job size must respect a minimum value which is enforced transparently. This minimum is either 512 KB, or overlapSize, whichever is largest. Different job sizes will lead to non-identical compressed frames. DICTIONARY BUILDER zstd offers dictionary compression, which greatly improves efficiency on small files and messages. It´s possible to train zstd with a set of samples, the result of which is saved into a file called a dictionary. Then, during compression and decompression, reference the same dictionary, using command -D dictionaryFileName. Compression of small files similar to the sample set will be greatly improved. --train FILEs Use FILEs as training set to create a dictionary. The training set should ideally contain a lot of samples (> 100), and weight typically 100x the target dictionary size (for example, ~10 MB for a 100 KB dictionary). --train can be combined with -r to indicate a directory rather than listing all the files, which can be useful to circumvent shell expansion limits. Since dictionary compression is mostly effective for small files, the expectation is that the training set will only contain small files. In the case where some samples happen to be large, only the first 128 KiB of these samples will be used for training. --train supports multithreading if zstd is compiled with threading support (default). Additional advanced parameters can be specified with --train-fastcover. The legacy dictionary builder can be accessed with --train-legacy. The slower cover dictionary builder can be accessed with --train-cover. Default --train is equivalent to --train-fastcover=d=8,steps=4. -o FILE Dictionary saved into FILE (default name: dictionary). --maxdict=# Limit dictionary to specified size (default: 112640 bytes). As usual, quantities are expressed in bytes by default, and it´s possible to employ suffixes (like KB or MB) to specify larger values. -# Use # compression level during training (optional). Will generate statistics more tuned for selected compression level, resulting in a small compression ratio improvement for this level. -B# Split input files into blocks of size # (default: no split) -M#, --memory=# Limit the amount of sample data loaded for training (default: 2 GB). Note that the default (2 GB) is also the maximum. This parameter can be useful in situations where the training set size is not well controlled and could be potentially very large. Since speed of the training process is directly correlated to the size of the training sample set, a smaller sample set leads to faster training. In situations where the training set is larger than maximum memory, the CLI will randomly select samples among the available ones, up to the maximum allowed memory budget. This is meant to improve dictionary relevance by mitigating the potential impact of clustering, such as selecting only files from the beginning of a list sorted by modification date, or sorted by alphabetical order. The randomization process is deterministic, so training of the same list of files with the same parameters will lead to the creation of the same dictionary. --dictID=# A dictionary ID is a locally unique ID. The decoder will use this value to verify it is using the right dictionary. By default, zstd will create a 4-bytes random number ID. It´s possible to provide an explicit number ID instead. It´s up to the dictionary manager to not assign twice the same ID to 2 different dictionaries. Note that short numbers have an advantage: an ID < 256 will only need 1 byte in the compressed frame header, and an ID < 65536 will only need 2 bytes. This compares favorably to 4 bytes default. Note that RFC8878 reserves IDs less than 32768 and greater than or equal to 2^31, so they should not be used in public. --train-cover[=k#,d=#,steps=#,split=#,shrink[=#]] Select parameters for the default dictionary builder algorithm named cover. If d is not specified, then it tries d = 6 and d = 8. If k is not specified, then it tries steps values in the range [50, 2000]. If steps is not specified, then the default value of 40 is used. If split is not specified or split <= 0, then the default value of 100 is used. Requires that d <= k. If shrink flag is not used, then the default value for shrinkDict of 0 is used. If shrink is not specified, then the default value for shrinkDictMaxRegression of 1 is used. Selects segments of size k with highest score to put in the dictionary. The score of a segment is computed by the sum of the frequencies of all the subsegments of size d. Generally d should be in the range [6, 8], occasionally up to 16, but the algorithm will run faster with d <= 8. Good values for k vary widely based on the input data, but a safe range is [2 * d, 2000]. If split is 100, all input samples are used for both training and testing to find optimal d and k to build dictionary. Supports multithreading if zstd is compiled with threading support. Having shrink enabled takes a truncated dictionary of minimum size and doubles in size until compression ratio of the truncated dictionary is at most shrinkDictMaxRegression% worse than the compression ratio of the largest dictionary. Examples: zstd --train-cover FILEs zstd --train-cover=k=50,d=8 FILEs zstd --train-cover=d=8,steps=500 FILEs zstd --train-cover=k=50 FILEs zstd --train-cover=k=50,split=60 FILEs zstd --train-cover=shrink FILEs zstd --train-cover=shrink=2 FILEs --train-fastcover[=k#,d=#,f=#,steps=#,split=#,accel=#] Same as cover but with extra parameters f and accel and different default value of split If split is not specified, then it tries split = 75. If f is not specified, then it tries f = 20. Requires that 0 < f < 32. If accel is not specified, then it tries accel = 1. Requires that 0 < accel <= 10. Requires that d = 6 or d = 8. f is log of size of array that keeps track of frequency of subsegments of size d. The subsegment is hashed to an index in the range [0,2^f - 1]. It is possible that 2 different subsegments are hashed to the same index, and they are considered as the same subsegment when computing frequency. Using a higher f reduces collision but takes longer. Examples: zstd --train-fastcover FILEs zstd --train-fastcover=d=8,f=15,accel=2 FILEs --train-legacy[=selectivity=#] Use legacy dictionary builder algorithm with the given dictionary selectivity (default: 9). The smaller the selectivity value, the denser the dictionary, improving its efficiency but reducing its achievable maximum size. --train-legacy=s=# is also accepted. Examples: zstd --train-legacy FILEs zstd --train-legacy=selectivity=8 FILEs BENCHMARK The zstd CLI provides a benchmarking mode that can be used to easily find suitable compression parameters, or alternatively to benchmark a computer´s performance. Note that the results are highly dependent on the content being compressed. -b# benchmark file(s) using compression level # -e# benchmark file(s) using multiple compression levels, from -b# to -e# (inclusive) -d benchmark decompression speed only (requires providing an already zstd-compressed content) -i# minimum evaluation time, in seconds (default: 3s), benchmark mode only -B#, --block-size=# cut file(s) into independent chunks of size # (default: no chunking) --priority=rt set process priority to real-time (Windows) Output Format: CompressionLevel#Filename: InputSize -> OutputSize (CompressionRatio), CompressionSpeed, DecompressionSpeed Methodology: For both compression and decompression speed, the entire input is compressed/decompressed in-memory to measure speed. A run lasts at least 1 sec, so when files are small, they are compressed/decompressed several times per run, in order to improve measurement accuracy. SEE ALSO zstdgrep(1), zstdless(1), gzip(1), xz(1) The zstandard format is specified in Y. Collet, "Zstandard Compression and the ´application/zstd´ Media Type", https://www.ietf.org/rfc/rfc8878.txt, Internet RFC 8878 (February 2021). BUGS Report bugs at: https://github.com/facebook/zstd/issues AUTHOR Yann Collet zstd 1.5.6 March 2024 ZSTD(1)
null
grpc_csharp_plugin
null
null
null
null
null
pyenv
pyenv lets you easily switch between multiple versions of Python. It's simple, unobtrusive, and follows the UNIX tradition of single-purpose tools that do one thing well. To start using pyenv 1. Append the following to $HOME/.bashrc if command -v pyenv 1>/dev/null 2>&1; then eval "$(pyenv init -)" fi Appending this line enables shims. Please make sure this line is placed toward the end of the shell configuration file since it manipulates PATH during the initialization. Debian note: Modify only your ~/.bashrc file instead of creating ~/.bash_profile Zsh note: Modify your ~/.zshrc file instead of ~/.bashrc Warning: If you configured your system so that BASH_ENV variable points to .bashrc. You should almost certainly put the above mentioned line into .bash_profile, and not into .bashrc. Otherwise you may observe strange behaviour, such as pyenv getting into an infinite loop. See #264 <https://github.com/pyenv/pyenv/issues/264> for details. 2. Restart your shell so the path changes take effect. You can now begin using pyenv. exec "$SHELL" 3. Install Python versions into $(pyenv root)/versions. For example, to download and install Python 3.6.12, run: pyenv install 3.6.12 NOTE: If you need to pass configure option to build, please use CONFIGURE_OPTS environment variable. If you are having trouble installing a python version, please visit the wiki page about Common Build Problems <https://github.com/pyenv/pyenv/wiki/Common-build-problems> Proxy note: If you use a proxy, export HTTP_PROXY and HTTPS_PROXY environment variables. Stop using pyenv The simplicity of pyenv makes it easy to temporarily disable it, or uninstall from the system. To disable pyenv managing your Python versions, simply remove the pyenv init line from your shell startup configuration. This will remove pyenv shims directory from PATH, and future invocations like python will execute the system Python version, as before pyenv. pyenv will still be accessible on the command line, but your Python apps won't be affected by version switching. COMMAND LINE OPTIONS Like git, the pyenv command delegates to subcommands based on its first argument. Some useful pyenv commands are: commands List all available pyenv commands exec Run an executable with the selected Python version global Set or show the global Python version(s) help Display help for a command hooks List hook scripts for a given pyenv command init Configure the shell environment for pyenv install Install a Python version using python-build local Set or show the local application-specific Python version(s) prefix Display prefix for a Python version rehash Rehash pyenv shims (run this after installing executables) root Display the root directory where versions and shims are kept shell Set or show the shell-specific Python version shims List existing pyenv shims uninstall Uninstall Python versions version Show the current Python version(s) and its origin version-file Detect the file that sets the current pyenv version version-name Show the current Python version version-origin Explain how the current Python version is set versions List all Python versions available to pyenv whence List all Python versions that contain the given executable which Display the full path to an executable See `pyenv help <command>' for information on a specific command. For full documentation, see COMMAND REFERENCE section
pyenv - Simple Python version management
pyenv <command> [<args>]
-h, --help Show summary of options. -v, --version Show version of program. COMPARISON pyenv does... • Let you change the global Python version on a per-user basis. • Provide support for per-project Python versions. • Allow you to override the Python version with an environment variable. • Search commands from multiple versions of Python at a time. This may be helpful to test across Python versions with tox In contrast with pythonbrew and pythonz, pyenv does not... • Depend on Python itself. pyenv was made from pure shell scripts. There is no bootstrap problem of Python. • Need to be loaded into your shell. Instead, pyenv's shim approach works by adding a directory to your $PATH. • Manage virtualenv. Of course, you can create virtualenv yourself, or pyenv-virtualenv to automate the process. How It Works At a high level, pyenv intercepts Python commands using shim executables injected into your PATH, determines which Python version has been specified by your application, and passes your commands along to the correct Python installation. Understanding PATH When you run a command like python or pip, your operating system searches through a list of directories to find an executable file with that name. This list of directories lives in an environment variable called PATH, with each directory in the list separated by a colon: /usr/local/bin:/usr/bin:/bin Directories in PATH are searched from left to right, so a matching executable in a directory at the beginning of the list takes precedence over another one at the end. In this example, the /usr/local/bin directory will be searched first, then /usr/bin, then /bin. Understanding Shims pyenv works by inserting a directory of shims at the front of your PATH: $(pyenv root)/shims:/usr/local/bin:/usr/bin:/bin Through a process called rehashing, pyenv maintains shims in that directory to match every Python command (python,pip,etc...) across every installed version of Python Shims are lightweight executables that simply pass your command along to pyenv. So with pyenv installed, when you run, say, pip, your operating system will do the following: • Search your PATH for an executable file named pip • Find the pyenv shim named pip at the beginning of your PATH • Run the shim named pip, which in turn passes the command along to pyenv Choosing the Python Version When you execute a shim, pyenv determines which Python version to use by reading it from the following sources, in this order: 1. The PYENV_VERSION environment variable (if specified). You can use the pyenv shell command to set this environment variable in your current shell session. 2. The application-specific .python-version file in the current directory (if present). You can modify the current directory's .python-version file with the pyenv local command. 3. The first .python-version file found (if any) by searching each parent directory, until reaching the root of your filesystem. 4. The global $(pyenv root)/version file. You can modify this file using the pyenv global command. If the global version file is not present, pyenv assumes you want to use the "system" Python. (In other words, whatever version would run if pyenv weren't in your PATH.) NOTE: You can activate multiple versions at the same time, including multiple versions of Python2 or Python3 simultaneously. This allows for parallel usage of Python2 and Python3, and is required with tools like tox. For example, to set your path to first use your system Python and Python3 (set to 2.7.9 and 3.4.2 in this example), but also have Python 3.3.6, 3.2, and 2.5 available on your PATH, one would first pyenv install the missing versions, then set pyenv global system 3.3.6 3.2 2.5. At this point, one should be able to find the full executable path to each of these using pyenv which, e.g. pyenv which python2.5 (should display $(pyenv root)/versions/2.5/bin/python2.5), or pyenv which python3.4 (should display path to system Python3). You can also specify multiple versions in a .python-version file, separated by newlines or any whitespace. hy Locating the Python Installation Once pyenv has determined which version of Python your application has specified, it passes the command along to the corresponding Python installation. Each Python version is installed into its own directory under $(pyenv root)/versions. For example, you might have these versions installed: • $(pyenv root)/versions/2.7.8/ • $(pyenv root)/versions/3.4.2/ • $(pyenv root)/versions/pypy-2.4.0/ As far as pyenv is concerned, version names are simply the directories in $(pyenv root)/versions. Managing Virtual Environments There is a pyenv plugin named pyenv-virtualenv which comes with various features to help pyenv users to manage virtual environments created by virtualenv or Anaconda. Because the activate script of those virtual environments are relying on mutating $PATH variable of user's interactive shell, it will intercept pyenv's shim style command execution hooks. We'd recommend to install pyenv-virtualenv as well if you have some plan to play with those virtual environments. Advanced Configuration Skip this section unless you must know what every line in your shell profile is doing. pyenv init is the only command that crosses the line of loading extra commands into your shell. Coming from rvm, some of you might be opposed to this idea. Here's what pyenv init actually does: 1. Sets up your shims path. This is the only requirement for pyenv to function properly. You can do this by hand by prepending $(pyenv root)/shims to your $PATH. 2. Rehashes shims. From time to time you'll need to rebuild your shim files. Doing this on init makes sure everything is up to date. You can always run pyenv rehash manually. You can disable this functionality by adding --no-rehash to the end of your pyenv init command line. 3. Installs the sh dispatcher. This bit is also optional, but allows pyenv and plugins to change variables in your current shell, making commands like pyenv shell possible. The sh dispatcher doesn't do anything crazy like override cd or hack your shell prompt, but if for some reason you need pyenv to be a real script rather than a shell function, you can safely skip it. To see exactly what happens under the hood for yourself, run "pyenv init -". Uninstalling Python Versions As time goes on, you will accumulate Python versions in your $(pyenv root)/versions directory. To remove old Python versions, pyenv uninstall command to automate the removal process. Alternatively, simply rm -rf the directory of the version you want to remove. You can find the directory of a particular Python version with the pyenv prefix command, e.g. pyenv prefix 2.6.8. Command Reference The most common subcommands are: pyenv commands Lists all available pyenv commands. pyenv local Sets a local application-specific Python version by writing the version name to a .python-version file in the current directory. This version overrides the global version, and can be overridden itself by setting the PYENV_VERSION environment variable or with the pyenv shell command. $ pyenv local 2.7.6 When run without a version number, pyenv local reports the currently configured local version. You can also unset the local version: $ pyenv local --unset Previous versions of pyenv stored local version specifications in a file named .pyenv-version. For backwards compatibility, pyenv will read a local version specified in an .pyenv-version file, but a .python-version file in the same directory will take precedence. You can specify multiple versions as local Python at once. Let's say if you have two versions of 2.7.6 and 3.3.3. If you prefer 2.7.6 over 3.3.3, $ pyenv local 2.7.6 3.3.3 $ pyenv versions system * 2.7.6 (set by /Users/yyuu/path/to/project/.python-version) * 3.3.3 (set by /Users/yyuu/path/to/project/.python-version) $ python --version Python 2.7.6 $ python2.7 --version Python 2.7.6 $ python3.3 --version Python 3.3.3 or, if you prefer 3.3.3 over 2.7.6, $ pyenv local 3.3.3 2.7.6 $ pyenv versions system * 2.7.6 (set by /Users/yyuu/path/to/project/.python-version) * 3.3.3 (set by /Users/yyuu/path/to/project/.python-version) venv27 $ python --version Python 3.3.3 $ python2.7 --version Python 2.7.6 $ python3.3 --version Python 3.3.3 pyenv global Sets the global version of Python to be used in all shells by writing the version name to the ~/.pyenv/version file. This version can be overridden by an application-specific .python-version file, or by setting the PYENV_VERSION environment variable. $ pyenv global 2.7.6 The special version name system tells pyenv to use the system Python (detected by searching your $PATH). When run without a version number, pyenv global reports the currently configured global version. You can specify multiple versions as global Python at once. Let's say if you have two versions of 2.7.6 and 3.3.3. If you prefer 2.7.6 over 3.3.3, $ pyenv global 2.7.6 3.3.3 $ pyenv versions system * 2.7.6 (set by /Users/yyuu/.pyenv/version) * 3.3.3 (set by /Users/yyuu/.pyenv/version) $ python --version Python 2.7.6 $ python2.7 --version Python 2.7.6 $ python3.3 --version Python 3.3.3 or, if you prefer 3.3.3 over 2.7.6, $ pyenv global 3.3.3 2.7.6 $ pyenv versions system * 2.7.6 (set by /Users/yyuu/.pyenv/version) * 3.3.3 (set by /Users/yyuu/.pyenv/version) venv27 $ python --version Python 3.3.3 $ python2.7 --version Python 2.7.6 $ python3.3 --version Python 3.3.3 pyenv shell Sets a shell-specific Python version by setting the PYENV_VERSION environment variable in your shell. This version overrides application-specific versions and the global version. $ pyenv shell pypy-2.2.1 When run without a version number, pyenv shell reports the current value of PYENV_VERSION. You can also unset the shell version: $ pyenv shell --unset Note that you'll need pyenv's shell integration enabled (step 3 of the installation instructions) in order to use this command. If you prefer not to use shell integration, you may simply set the PYENV_VERSION variable yourself: $ export PYENV_VERSION=pypy-2.2.1 You can specify multiple versions via PYENV_VERSION at once. Let's say if you have two versions of 2.7.6 and 3.3.3. If you prefer 2.7.6 over 3.3.3, $ pyenv shell 2.7.6 3.3.3 $ pyenv versions system * 2.7.6 (set by PYENV_VERSION environment variable) * 3.3.3 (set by PYENV_VERSION environment variable) $ python --version Python 2.7.6 $ python2.7 --version Python 2.7.6 $ python3.3 --version Python 3.3.3 or, if you prefer 3.3.3 over 2.7.6, $ pyenv shell 3.3.3 2.7.6 $ pyenv versions system * 2.7.6 (set by PYENV_VERSION environment variable) * 3.3.3 (set by PYENV_VERSION environment variable) venv27 $ python --version Python 3.3.3 $ python2.7 --version Python 2.7.6 $ python3.3 --version Python 3.3.3 pyenv install Install a Python version Usage: pyenv install [-f] [-kvp] <version> pyenv install [-f] [-kvp] <definition-file> pyenv install -l|--list -l, --list List all available versions -f, --force Install even if the version appears to be installed already -s, --skip-existing Skip the installation if the version appears to be installed already python-build options: -k, --keep Keep source tree in $PYENV_BUILD_ROOT after installation (defaults to $PYENV_ROOT/sources) -v, --verbose Verbose mode: print compilation status to stdout -p, --patch Apply a patch from stdin before building -g, --debug Build a debug version To list the all available versions of Python, including Anaconda, Jython, pypy, and stackless, use: $ pyenv install --list Then install the desired versions: $ pyenv install 2.7.6 $ pyenv install 2.6.8 $ pyenv versions system 2.6.8 * 2.7.6 (set by /home/yyuu/.pyenv/version) pyenv uninstall Uninstall Python versions. Usage: pyenv uninstall [-f|--force] <version> ... -f Attempt to remove the specified version without prompting for confirmation. If the version does not exist, do not display an error message. pyenv rehash Installs shims for all Python binaries known to pyenv (i.e., ~/.pyenv/versions/*/bin/*). Run this command after you install a new version of Python, or install a package that provides binaries. $ pyenv rehash pyenv version Displays the currently active Python version, along with information on how it was set. $ pyenv version 2.7.6 (set by /home/yyuu/.pyenv/version) pyenv versions Lists all Python versions known to pyenv, and shows an asterisk next to the currently active version. $ pyenv versions 2.5.6 2.6.8 * 2.7.6 (set by /home/yyuu/.pyenv/version) 3.3.3 jython-2.5.3 pypy-2.2.1 pyenv which Displays the full path to the executable that pyenv will invoke when you run the given command. $ pyenv which python3.3 /home/yyuu/.pyenv/versions/3.3.3/bin/python3.3 pyenv whence Lists all Python versions with the given command installed. $ pyenv whence 2to3 2.6.8 2.7.6 3.3.3 Environment variables You can affect how pyenv operates with the following settings: name (default) description PYENV_VERSION Specifies the Python version to be used. Also see pyenv shell PYENV_ROOT (~/.pyenv) Defines the directory under which Python versions and shims reside. Also see pyenv root PYENV_DEBUG Outputs debug information. Also as: pyenv --debug <subcommand> PYENV_HOOK_PATH Colon-separated list of paths searched for pyenv hooks. PYENV_DIR ($PWD) Directory to start searching for .python-version files. HTTP_PROXY,HTTPS_PROXY Proxy Variables CONFIGURE_OPTS Pass configure options to build. PYTHON_BUILD_ARIA2_OPTS Used to pass additional parameters to aria2 <https://aria2.github.io/> If the aria2c binary is available on PATH, pyenv uses aria2c instead of curl or wget to download the Python Source code. If you have an unstable internet connection, you can use this variable to instruct aria2 to accelerate the download. In most cases, you will only need to use -x 10 -k 1M as value to PYTHON_BUILD_ARIA2_OPTS environment variable License The MIT License PYENV 24 Apr 2023 PYENV(1)
null
ssl_client2
null
null
null
null
null
gpgtar
gpgtar encrypts or signs files into an archive. It is an gpg-ized tar using the same format as used by PGP's PGP Zip.
gpgtar - Encrypt or sign files into an archive
gpgtar [options] filename1 [ filename2, ... ] directory1 [ directory2, ... ]
gpgtar understands these options: --create Put given files and directories into a vanilla ``ustar'' archive. --extract Extract all files from a vanilla ``ustar'' archive. If no file name is given (or it is "-") the archive is taken from stdin. --encrypt -e Encrypt given files and directories into an archive. This option may be combined with option --symmetric for an archive that may be decrypted via a secret key or a passphrase. --decrypt -d Extract all files from an encrypted archive. If no file name is given (or it is "-") the archive is taken from stdin. --sign -s Make a signed archive from the given files and directories. This can be combined with option --encrypt to create a signed and then encrypted archive. --list-archive -t List the contents of the specified archive. If no file name is given (or it is "-") the archive is taken from stdin. --symmetric -c Encrypt with a symmetric cipher using a passphrase. The default symmetric cipher used is AES-128, but may be chosen with the --cipher-algo option to gpg. --recipient user -r user Encrypt for user id user. For details see gpg. --local-user user -u user Use user as the key to sign with. For details see gpg. --output file -o file Write the archive to the specified file file. --verbose -v Enable extra informational output. --quiet -q Try to be as quiet as possible. --skip-crypto Skip all crypto operations and create or extract vanilla ``ustar'' archives. --dry-run Do not actually output the extracted files. --directory dir -C dir Extract the files into the directory dir. The default is to take the directory name from the input filename. If no input filename is known a directory named ‘GPGARCH’ is used. For tarball creation, switch to directory dir before performing any operations. --files-from file -T file Take the file names to work from the file file; one file per line. --null Modify option --files-from to use a binary nul instead of a linefeed to separate file names. --utf8-strings Assume that the file names read by --files-from are UTF-8 encoded. This option has an effect only on Windows where the active code page is otherwise assumed. --openpgp This option has no effect because OpenPGP encryption and signing is the default. --cms This option is reserved and shall not be used. It will eventually be used to encrypt or sign using the CMS protocol; but that is not yet implemented. --batch Use batch mode. Never ask but use the default action. This option is passed directly to gpg. --yes Assume "yes" on most questions. Often used together with --batch to overwrite existing files. This option is passed directly to gpg. --no Assume "no" on most questions. This option is passed directly to gpg. --require-compliance This option is passed directly to gpg. --status-fd n Write special status strings to the file descriptor n. See the file DETAILS in the documentation for a listing of them. --with-log When extracting an encrypted tarball also write a log file with the gpg output to a file named after the extraction directory with the suffix ".log". --set-filename file Use the last component of file as the output directory. The default is to take the directory name from the input filename. If no input filename is known a directory named ‘GPGARCH’ is used. This option is deprecated in favor of option --directory. --no-compress This option tells gpg to disable compression (i.e. using option -z0). It is useful for archiving only large files which are are already compressed (e.g. a set of videos). --gpg gpgcmd Use the specified command gpgcmd instead of gpg. --gpg-args args Pass the specified extra options to gpg. --tar-args args Assume args are standard options of the command tar and parse them. The only supported tar options are "--directory", "--files-from", and "--null" This is an obsolete options because those supported tar options can also be given directly. --tar command This is a dummy option for backward compatibility. --version Print version of the program and exit. --help Display a brief help page and exit.
Encrypt the contents of directory ‘mydocs’ for user Bob to file ‘test1’: gpgtar --encrypt --output test1 -r Bob mydocs List the contents of archive ‘test1’: gpgtar --list-archive test1 DIAGNOSTICS The program returns 0 if everything was fine, 1 otherwise. SEE ALSO gpg(1), tar(1), The full documentation for this tool is maintained as a Texinfo manual. If GnuPG and the info program are properly installed at your site, the command info gnupg should give you access to the complete manual including a menu structure and an index. GnuPG 2.4.5 2024-03-04 GPGTAR(1)
dh_client
null
null
null
null
null
ccmake
null
null
null
null
null
env_parallel.fish
null
null
null
null
null