When I run an application via java -cp
(without --add-modules
or --limit-modules
), some Java system modules are observable while the others are not.
For example, all java.se
modules are observable. All java.se.ee
modules are not observable. I know that javafx.*
modules are observable. jdk.unsupported
and jdk.shell
are observable too.
So, is my assumption correct: if no --add-modules
and --limit-modules
are specified, the set of observable system modules consists of all system modules except java.se.ee
?
Is there a reliable way to know the exact list of default observable system modules? I know there is a --list-modules
option, but it lists all modules including java.se.ee
.
In short, yes that is correct.
The default set of modules enabled in Java 9 are known as the root modules. Per JEP 261, the default set of root modules are defined as:
Here is a nice graphic of what is included in the
(Source: Java 9 javadoc)
java.se
module:Like the
java.se
aggregate module, thejava.se.ee
module itself does not provide any classes, it is an aggregate module that includes the following modules:Your terminology is slightly off here. In Java 9 a module is observable if both of the following are true:
--limit-modules
This means
java.se.ee
is observable by default.I think instead you are wondering what modules are the default set of root modules? In which case, see the above definition of root modules.