I am working on adopting jlink in order to create a much smaller runtime to embed with the macOS application version of a free software package, and I nearly have it working (with my application shrinking from around 260MB to 90MB). The problem that I am running into is that my software uses the ZIP filesystem, and when it tries to open such a filesystem when running with the jlink-created runtime, code that works fine with the normal OpenJDK 11 runtime suddenly crashes with:
java.nio.file.FileSystems.newFileSystem
java.nio.file.ProviderNotFoundException: Provider not found
I am assuming this is because jlink has no way of knowing without being told that ZIP filesystem support should be included in my runtime, since my code doesn’t explicitly mention any of its classes (they are used indirectly via java.nio).
So does anyone know how I can explicitly tell jlink to include them?
Of course, shortly after posting this question, my google-fu improved, and I found the answer. In JDK 11, jdk.zipfs is its own module, containing this provider. So I just needed to add that to my --add-modules list, and it is now working.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With