If the resource and the module are known, we can use the ModuleLayer to access it like the following snippet.
ModuleLayer.boot().findModule(<MODULE_NAME>).ifPresent(___module -> { try { var modResource = ___module.getResourceAsStream(<RESOURCE_NAME>); } catch (IOException e) { e.printStackTrace(); } });
Where:
MODULE_NAME -> the name of the module that has the resource.
RESOURCE_NAME -> the resource of interest.
Leave a Reply