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")
?
A module path is a reference to a module, as used with require or as the initial-module-path in a module form. It can be any of several forms: (quote id) A module path that is a quoted identifier refers to a non-file module declaration using the identifier. This form of module reference makes the most sense in a REPL.
A CLASSPATH is a sequence of classes' base paths and JAR files for the Java Compiler or JVM to locate the classes used in the application. Similarly, in JDK 9, a MODULEPATH is a sequence of modules' base paths and Modular JAR files for the Java Compiler or JVM to locate the modules used in the application.
module-info. java file. It declares the dependencies within the module system and allows the compiler and the runtime to police the boundaries/access violations between the modules in your application.
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")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With