On 31/01/2023 12:52, Alex Orlov wrote:
:
To create module finder I do:
ModuleFinder jarModuleFinder = ModuleFinder.of(jarModulePaths.toArray(new Path[jarModulePaths.size()]));
To check found modules I do:
final Set<String> foundModulePaths = new HashSet<>();
for (ModuleReference reference : moduleFinder.findAll()) {
            var path = reference.location().get().getPath();
            foundModulePaths.add(path);
 }


findAll will find occurrence of all modules so it might be that the module in jakarta.servlet.jsp.jstl-2.0.0.jar has the same name as a module that is one of the preceding elements of the module path. Can you try this:

java --module-path <dir>/jakarta.servlet.jsp.jstl-2.0.0.jar --list-modules

and you should see the module in output. Then change your loop above to print the module names and see if it gets printed.

BTW: In the above you are using URI::getPath. That returns the decoded path component of the file URI - you can't reliably use this as a file path, I think the code you want here is Path.of(uri).toString().

-Alan

Reply via email to