Artem Petrov
Artem Petrov

Reputation: 802

Inspect --module-path value at runtime

Is there any way to get list of directories which are included in module-path with use of -p or --module-path arguments at runtime similar to how I whold get all classpath directories using System.getProperty("java.class.path")?

Upvotes: 7

Views: 2029

Answers (1)

ZhekaKozlov
ZhekaKozlov

Reputation: 39576

From Javadoc of System.getProperties:

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

So you should use System.getProperty("jdk.module.path")

Upvotes: 11

Related Questions