<div dir="ltr"><div dir="ltr">I guess you could get the package name from the class name and then iterate through the modules in the ModuleLayer to find which module the package is in.<br></div><div dir="ltr"><br></div><div>Glavo</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Dec 16, 2023 at 5:47 AM PavelTurk <<a href="mailto:pavelturk2000@gmail.com">pavelturk2000@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello all.<br>
<br>
Please, consider the following code:<br>
<br>
ClassLoader cl = ....<br>
String className = "com.foo.Bar";<br>
Module module = ???<br>
<br>
So, we have class name in a String and it is necessary to get reference to module<br>
that has this class. The question - is it possible to find out:<br>
1) without loading the class -<br>
Module module = cl.loadClass(className).getModule();<br>
2) without reading content of every module<br>
ModuleReference reference = ...<br>
reference.open().list()....<br>
<br>
I mean, is there any ready solution that I can use to find module by class name and without loading class?<br>
<br>
Best regards, Pavel<br>
<br>
</blockquote></div>