Getting the automatic module name of non-modular JAR

Gunnar Morling gunnar at
Mon Apr 24 20:23:23 UTC 2017


Given a non-modular JAR (e.g. represented as Path), what's the easiest
way to obtain the automatic module name derived for this JAR?

I found the following:

    Path nonModularJar = ...;
    String automaticModuleName = ModuleFinder.of( nonModularJar )

Is this the best I can do?

More generally speaking, is using ModuleFinder with a single path the
only way to obtain a ModuleReference/ModuleDescriptor for a specific



More information about the jigsaw-dev mailing list