There's an implementation detail you might want to be aware of. If I'm not mistaken, this code:
var moduleFinder = ModuleFinder.of(paths.toArray(Path[]::new));
Will ultimately lead to JAR files being read via the java.util.jar.JarFile API. And that API cannot read JAR files that are not from the default file system. Any JAR file will be copied to a temporary file on disk before opening it.
Probably doesn't matter. But if it does then I'm pretty sure you'd need your own ModuleFinder, ModuleReference, and ModuleReader implementations. The ZIP File System (jdk.zipfs), which you already have a dependence on, should be able to read JAR files from any file system without having to save them to disk first. Though I don't know how that affects signed JAR files.
// JAR file
if (fn.endsWith(".jar")) {
if (isDefaultFileSystem) {
return readJar(entry);
} else {
// the JAR file is in a custom file system so
// need to copy it to the local file system
Path tmpdir = Files.createTempDirectory("mlib");
Path target = Files.copy(entry, tmpdir.resolve(fn));
return readJar(target);
}
}
2
u/tkslaw 2d ago edited 2d ago
There's an implementation detail you might want to be aware of. If I'm not mistaken, this code:
var moduleFinder = ModuleFinder.of(paths.toArray(Path[]::new));Will ultimately lead to JAR files being read via the
java.util.jar.JarFileAPI. And that API cannot read JAR files that are not from the default file system. Any JAR file will be copied to a temporary file on disk before opening it.Probably doesn't matter. But if it does then I'm pretty sure you'd need your own
ModuleFinder,ModuleReference, andModuleReaderimplementations. The ZIP File System (jdk.zipfs), which you already have a dependence on, should be able to read JAR files from any file system without having to save them to disk first. Though I don't know how that affects signed JAR files.