How can I create an OpenJDK modular runtime for use with Joval?

Joval can be run using the full OpenJDK distribution, but that is a relatively large package. OpenJDK makes it possible to create a modular runtime that can be used in conjunction with specific Java programs.

While Joval is not built using any module declarations (the module system was introduced in Java 9, but Joval supports JREv6 and later), it is still possible to create a modular Java runtime for use with Joval.

We used jdeps to analyze the module dependencies for Joval-Utilities.jar (v6.1.3), and then used jlink to create a suitable runtime using the command (using OpenJDK 12.0.1):

jlink --no-header-files --no-man-pages --compress=2 --strip-debug --add-modules java.datatransfer,java.desktop,java.instrument,java.logging,,java.naming,java.prefs,java.scripting,,java.sql,java.xml,java.xml.crypto --output java-runtime

This command produces a ~40MB runtime that worked nominally using typical command-lines.