{"record":{"id":"4bbab79200edcaa9","repo":"HMCL-dev/HMCL","slug":"missing-release-file-4bbab7","errorCode":null,"errorMessage":"Missing release file","messagePattern":"Missing release file","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"HMCLCore/src/main/java/org/jackhuang/hmcl/java/JavaInfo.java","lineNumber":95,"sourceCode":"            throw new IOException(\"Unknown operating system: \" + osName);\n\n        if (arch == Architecture.UNKNOWN)\n            throw new IOException(\"Unknown architecture: \" + osArch);\n\n        if (javaVersion == null)\n            throw new IOException(\"Missing Java version\");\n\n        return new JavaInfo(Platform.getPlatform(os, arch), javaVersion, vendor);\n    }\n\n    public static <F, E extends ArchiveEntry> JavaInfo fromArchive(ArchiveFileTree<F, E> tree) throws IOException {\n        if (tree.getRoot().getSubDirs().size() != 1 || !tree.getRoot().getFiles().isEmpty())\n            throw new IOException();\n\n        ArchiveFileTree.Dir<E> jdkRoot = tree.getRoot().getSubDirs().values().iterator().next();\n        E releaseEntry = jdkRoot.getFiles().get(\"release\");\n        if (releaseEntry == null)\n            throw new IOException(\"Missing release file\");\n\n        JavaInfo info;\n        try (BufferedReader reader = new BufferedReader(new InputStreamReader(tree.getInputStream(releaseEntry), StandardCharsets.UTF_8))) {\n            info = JavaInfo.fromReleaseFile(reader);\n        }\n\n        ArchiveFileTree.Dir<E> binDir = jdkRoot.getSubDirs().get(\"bin\");\n        if (binDir == null || binDir.getFiles().get(info.getPlatform().getOperatingSystem().getJavaExecutable()) == null)\n            throw new IOException(\"Missing java executable file\");\n\n        return info;\n    }\n\n    public static String normalizeVendor(String vendor) {\n        if (vendor == null)\n            return null;\n\n        return switch (vendor) {","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/HMCL-dev/HMCL/blob/24702dc5a0214034f4c27166d5fd30cad08cec19/HMCLCore/src/main/java/org/jackhuang/hmcl/java/JavaInfo.java#L77-L113","documentation":"JavaInfo.fromArchive requires the JDK root directory inside the archive to contain a 'release' file — the standard marker file JDK distributions ship with version info (JAVA_VERSION, vendor, etc.). It throws IOException(\"Missing release file\") when that entry is absent, because version metadata cannot be parsed without it.","triggerScenarios":"JavaInfo.fromArchive(tree) succeeds the single-root-directory check, but jdkRoot.getFiles().get(\"release\") returns null — the JDK directory inside the archive has no 'release' file at its root.","commonSituations":"Using a JRE-only or custom-built distribution that omits the release file; manually assembled JDK directories; some minimal/minimal-jlink images; archives stripped of metadata files.","solutions":["Use a complete JDK distribution archive that includes the 'release' file at the JDK root.","If building a custom runtime with jlink, generate a release file or obtain JavaInfo another way.","Re-download the distribution from the vendor; a partial download may have dropped entries.","Catch the IOException and fall back to running 'java -version' on the extracted binary to detect the version."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"E releaseEntry = tree.getRoot().getSubDirs().values().iterator().next().getFiles().get(\"release\");\nif (releaseEntry == null) {\n    throw new IOException(\"Archive JDK root has no 'release' file; not a full JDK distribution\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    JavaInfo info = JavaInfo.fromArchive(tree);\n} catch (IOException e) {\n    if (e.getMessage().contains(\"Missing release file\")) {\n        // fall back to running java -version on the extracted binary\n    }\n}","preventionTips":["Only use full JDK distributions that include the release marker file","Avoid jlink-minimized or manually assembled runtimes when metadata detection is needed","Check archive integrity/checksums after download"],"tags":["java","jdk","archive","missing-file"],"backgroundTag":"file-not-found","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"}