{"record":{"id":"891df140da792987","repo":"HMCL-dev/HMCL","slug":"module-jdk-zipfs-does-not-exist","errorCode":null,"errorMessage":"Module jdk.zipfs does not exist","messagePattern":"Module jdk\\.zipfs does not exist","errorType":"exception","errorClass":"FileSystemNotFoundException","httpStatus":null,"severity":"critical","filePath":"HMCLCore/src/main/java/org/jackhuang/hmcl/util/io/CompressingUtils.java","lineNumber":238,"sourceCode":"    public static FileSystem createWritableZipFileSystem(Path zipFile) throws IOException {\n        return createWritableZipFileSystem(zipFile, null);\n    }\n\n    public static FileSystem createWritableZipFileSystem(Path zipFile, Charset charset) throws IOException {\n        return createZipFileSystem(zipFile, true, true, charset);\n    }\n\n    public static FileSystem createZipFileSystem(Path zipFile, boolean create, boolean useTempFile, Charset encoding) throws IOException {\n        Map<String, Object> env = new HashMap<>();\n        if (create)\n            env.put(\"create\", \"true\");\n        if (encoding != null)\n            env.put(\"encoding\", encoding.name());\n        if (useTempFile)\n            env.put(\"useTempFile\", true);\n        try {\n            if (ZIPFS_PROVIDER == null)\n                throw new FileSystemNotFoundException(\"Module jdk.zipfs does not exist\");\n\n            return ZIPFS_PROVIDER.newFileSystem(zipFile, env);\n        } catch (UnsupportedOperationException ex) {\n            throw new ZipException(\"Not a zip file\");\n        } catch (FileSystemNotFoundException ex) {\n            throw Lang.apply(new ZipException(\"Java Environment is broken\"), it -> it.initCause(ex));\n        }\n    }\n\n    /**\n     * Read the text content of a file in zip.\n     *\n     * @param zipFile the zip file\n     * @param name    the location of the text in zip file, something like A/B/C/D.txt\n     * @return the plain text content of given file.\n     * @throws IOException if the file is not a valid zip file.\n     */\n    public static String readTextZipEntry(Path zipFile, String name) throws IOException {","sourceCodeStart":220,"sourceCodeEnd":256,"githubUrl":"https://github.com/HMCL-dev/HMCL/blob/24702dc5a0214034f4c27166d5fd30cad08cec19/HMCLCore/src/main/java/org/jackhuang/hmcl/util/io/CompressingUtils.java#L220-L256","documentation":"createZipFileSystem opens a zip via the jdk.zipfs NIO file-system provider, resolved statically. If the provider is absent — the JVM was started with --limit-modules / -p restrictions or runs on a stripped JRE without jdk.zipfs — the method throws FileSystemNotFoundException with this message (later wrapped as a ZipException 'Java Environment is broken' only for provider-lookup failures; the direct throw surfaces as FileSystemNotFoundException).","triggerScenarios":"Running on a custom/minimal JRE without jdk.zipfs, or launching with module flags (--limit-modules, --add-modules omitted) that exclude jdk.zipfs, then calling createZipFileSystem via createReadOnlyZipFileSystem/createWritableZipFileSystem.","commonSituations":"Bundling the app with jlink and forgetting to include jdk.zipfs; custom runtime images for distribution; security-hardened JVMs with restricted module graphs.","solutions":["Include jdk.zipfs in the runtime: run with --add-modules jdk.zipfs or add it to the jlink command (jlink --add-modules ...,jdk.zipfs).","Switch to a full JRE/JDK that ships jdk.zipfs.","Fall back to java.util.zip.ZipFile-based access instead of the NIO zip filesystem when the provider is unavailable."],"exampleFix":"// before\njava -jar app.jar // minimal runtime, no jdk.zipfs\n\n// after\njava --add-modules jdk.zipfs -jar app.jar\n// or at build time:\njlink --add-modules java.base,jdk.zipfs --output runtime","handlingStrategy":"fallback","validationCode":"static boolean zipfsAvailable() { try { Class.forName(\"jdk.nio.zipfs.ZipFileSystemProvider\"); return true; } catch (ClassNotFoundException e) { return false; } }","typeGuard":null,"tryCatchPattern":"try { return CompressingUtils.createReadOnlyZipFileSystem(path); } catch (FileSystemNotFoundException e) { log.warn(\"jdk.zipfs missing; falling back to ZipFile\", e); return null; }","preventionTips":["Include jdk.zipfs in jlink/custom runtime images.","Launch with --add-modules jdk.zipfs when using --limit-modules.","Smoke-test zipfs availability at application startup."],"tags":["zip","java-modules","jre","environment"],"backgroundTag":"missing-dependency","analyzedSha":"24702dc5a0214034f4c27166d5fd30cad08cec19","analyzedAt":"2026-09-10T12:36:46.680Z","contentChangedAt":"2026-09-10T12:36:46.680Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}