Using a jar or module catalog as input for your application, you can use ModuleFinder to start further by using findAll to find the set of all module references that this crawler can find.
Path dir1, dir2, dir3; ModuleFinder finder = ModuleFinder.of(dir1, dir2, dir3); Set<ModuleReference> moduleReferences = finder.findAll();
It is easily possible with a command line parameter to display modules as:
java -p <jarfile> --list-modules
which should be sufficient, though, if you do not want to intentionally go into configuring things with ModuleLayer and Configuration java.lang.module , as indicated in @Alan's answer .
nullpointer
source share