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
.
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?
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:
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.
Here is a nice graphic of what is included in the java.se
module:
(Source: Java 9 javadoc)
Like the java.se
aggregate module, the java.se.ee
module itself does not provide any classes, it is an aggregate module that includes the following modules:
java.se
java.activation
java.annotations.common
java.corba
java.transaction
java.xml.bind
java.xml.ws
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.
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.