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


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

✍: FYIcenter


"jimage" command allows you to view and extract JImage files, which are generated by the "jlink" command.

"jimage" 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 "jimage" 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.jimage.Main --help

Usage: jimage <extract | info | list | verify> <options> jimage...

  extract  - Extract all jimage entries and place in a directory specified
             by the --dir=<directory> (default=.) option.

  info     - Prints detailed information contained in the jimage header.

  list     - Prints the names of all the entries in the jimage.  When used with
             --verbose, list will also print entry size and offset attributes.

  verify   - Reports on any .class entries that dont verify as classes.

Possible options include:
       --dir                        Target directory for extract directive
  -h,  --help                       Print usage message
       --include <pattern-list>     Pattern list for filtering entries.
       --verbose                    Listing prints entry size and offset
       --version                    Print version information

For options requiring a <pattern-list>, the value will be a comma separated
list of elements each using one the following forms:


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

⇐ jdk.jfr/jdk.jfr.internal.cmd.Execute - JFR Tool

⇑ Tools Supported from JDK 9+ lib\modules JImage

⇑⇑ FAQ for JDK (Java Development Kit)

2020-01-29, 851👍, 0💬