An example: since JavaFx was dropped from the JDK, the JavaFx SDK is now distributed as a set of modular jars. To compile a JavaFx application, of course you have to put them on the module path:
javac -p /path/to/jars/ App.java
That doesn't suffice, however. Trying to compile will cause a lot of errors similar to
sample/App.java:3: error: package javafx.application is not visible
import javafx.application.Application;
^
(package javafx.application is declared in module javafx.graphics, which is not in the module graph)
To resolve this, we can add javafx.graphics with --add-modules:
javac -p /path/to/jars/ --add-modules javafx.graphics App.java
If we added a module-info.java (containing just module ui {}) to the project instead, though, we have no issue.
Why are the modules on the module path visible to named modules but not the unnamed module?