在运行时检查 --module-path 值

Inspect --module-path value at runtime

有没有办法在运行时使用 -p--module-path 参数获取包含在模块路径中的目录列表,类似于我使用 [= 获取所有类路径目录的方式12=]?

来自 System.getProperties 的 Javadoc:

In addition to the standard system properties,
the system properties may include the following keys:

Key                      Description of Associated Value
jdk.module.path          The application module path
jdk.module.upgrade.path  The upgrade module path
jdk.module.main          The module name of the initial/main module
jdk.module.main.class    The main class name of the initial module

所以你应该使用System.getProperty("jdk.module.path")