C:\1Z0-817\app>jar --verbose --create --file app.jar .
We put all JARs (application and utility) to module path rather than class path and make application JAR modular.
Application depends on 3 modules: info.logger (automatic module name for info-logger.jar), java.base (implicitly required by any module), and java.logging.
Real module, but without module descriptor.
We make all library JARs modular and put on the module path, keep application JAR non-modular and put on the class path (it will become part of the unnamed module).
NOTE: module name may not contain dash character, it get replaced with period character automatically by jdeps utility.
C:\1Z0-817\info-logger>jar --verbose --create --file info-logger.jar .
The java.se module is a root, if it exists. If it does not exist then every java.* module on the upgrade module path or among the system modules that exports at least one package, without qualification, is a root.
Every non-java.* module on the upgrade module path or among the system modules that exports at least one package, without qualification, is also a root.
At run time it is the application's main module, as specified via the --module (or -m for short) launcher option.
It is occasionally necessary to add modules to the default root set in order to ensure that specific platform, library, or service-provider modules will be present in the module graph. In any phase the option --add-modules <module>(,<module*>)* where <module> is a module name, adds the named modules to the default set of root modules.
So, we had to use --add-modules info.logger option to tell the Java runtime to include the module by name to the default root set. There are also predefined constants: ALL-MODULE-PATH, ALL-DEFAULT, and ALL-SYSTEM.
The --module-path option tells the Java runtime the location of our modules.