jdk.jlink/jdk.tools.jmod.Main - "jmod" Command

Q

How to run "jmod" command from JDK lib\modules JImage file?

✍: FYIcenter

A

"jmod" command allows you to to create and manage JMod files to store compiled Java class files of a single Java module.

"jmod" command is supported by the jmods\jdk.jlink.jmod module file, which is also linked into the lib\modules JImage file in JDK 9, 10, and 11.

You can run the "jmod" command using the lib\modules JImage file as described below using JDK 11 as an example:

C:\fyicenter>set JDK_HOME=\fyicenter\jdk-11.0.1

C:\fyicenter>%JDK_HOME%\bin\java --module jdk.jlink/jdk.tools.jmod.Main --help

Usage: jmod (create|extract|list|describe|hash) <OPTIONS> <jmod-file>

Main operation modes:
  create    - Creates a new jmod archive
  extract   - Extracts all the files from the archive
  list      - Prints the names of all the entries
  describe  - Prints the module details
  hash      - Records hashes of tied modules.

 Option                               Description
 ------                               -----------
  --class-path <path>                  Application jar files|dir containing
                                         classes
  --cmds <path>                        Location of native commands
  --config <path>                      Location of user-editable config files
  --dir <path>                         Target directory for extract
  --dry-run                            Dry run of hash mode
  --exclude <pattern-list>             Exclude files matching the supplied
                                         comma separated pattern list, each
                                         element using one the following
                                         forms: <glob-pattern>, glob:<glob-
                                         pattern> or regex:<regex-pattern>
  -h, --help                           Print this usage message
  --hash-modules <regex-pattern>       Compute and record hashes to tie a
                                         packaged module with modules
                                         matching the given <regex-pattern>
                                         and depending upon it directly or
                                         indirectly. The hashes are recorded
                                         in the JMOD file being created, or a
                                         JMOD file or modular JAR on the
                                         module path specified the jmod hash
                                         command.
  --header-files <path>                Location of header files
  --help-extra                         Print help on extra options
  --legal-notices <path>               Location of legal notices
  --libs <path>                        Location of native libraries
  --main-class <class-name>            Main class
  --man-pages <path>                   Location of man pages
  --module-version <module-version>    Module version
  -p, --module-path <path>             Module path
  --target-platform <target-platform>  Target platform
  --version                            Version information
  @<filename>                          Read options from the specified file

 

jdk.jshell/jdk.internal.jshell.tool.JShellToolProvider - "jshell" Command

jdk.jlink/jdk.tools.jlink.internal.Main - "jlink" Command

Tools Supported from JDK 9+ lib\modules JImage

⇑⇑ FAQ for JDK (Java Development Kit)

2018-11-09, 254👍, 0💬