Getting the automatic module name of non-modular JAR
    Gunnar Morling 
    gunnar at hibernate.org
       
    Mon Apr 24 20:23:23 UTC 2017
    
    
  
Hi,
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 )
        .findAll()
        .iterator()
        .next()
        .descriptor()
        .name();
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
JAR?
Thanks,
--Gunnar
    
    
More information about the jigsaw-dev
mailing list