{"record":{"id":"1970e34967275bc9","repo":"HMCL-dev/HMCL","slug":"missing-release-file","errorCode":null,"errorMessage":"Missing release file ","messagePattern":"Missing release file ","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"HMCL/src/main/java/org/jackhuang/hmcl/ui/main/JavaManagementPage.java","lineNumber":149,"sourceCode":"            return;\n        }\n        Controllers.navigateForward(new JavaRestorePage(SettingsManager.userSettings().getDisabledJava()));\n    }\n\n    private void onAddJavaBinary(Path file) {\n        JavaManager.getAddJavaTask(file).whenComplete(Schedulers.javafx(), exception -> {\n            if (exception != null) {\n                LOG.warning(\"Failed to add java\", exception);\n                Controllers.dialog(i18n(\"java.add.failed\"), i18n(\"message.error\"), MessageDialogPane.MessageType.ERROR);\n            }\n        }).start();\n    }\n\n    private void onAddJavaHome(Path file) {\n        Task.composeAsync(() -> {\n            Path releaseFile = file.resolve(\"release\");\n            if (Files.notExists(releaseFile))\n                throw new IOException(\"Missing release file \" + releaseFile);\n            return JavaManager.getAddJavaTask(file.resolve(\"bin\").resolve(OperatingSystem.CURRENT_OS.getJavaExecutable()));\n        }).whenComplete(Schedulers.javafx(), exception -> {\n            if (exception != null) {\n                LOG.warning(\"Failed to add java\", exception);\n                Controllers.dialog(i18n(\"java.add.failed\"), i18n(\"message.error\"), MessageDialogPane.MessageType.ERROR);\n            }\n        }).start();\n    }\n\n    private void onInstallArchive(Path file) {\n        Task.supplyAsync(() -> {\n            try (ArchiveFileTree<?, ?> tree = ArchiveFileTree.open(file)) {\n                JavaInfo info = JavaInfo.fromArchive(tree);\n\n                if (!JavaManager.isCompatible(info.getPlatform()))\n                    throw new UnsupportedPlatformException(info.getPlatform().toString());\n\n                return Pair.pair(tree.getRoot().getSubDirs().keySet().iterator().next(), info);","sourceCodeStart":131,"sourceCodeEnd":167,"githubUrl":"https://github.com/HMCL-dev/HMCL/blob/24702dc5a0214034f4c27166d5fd30cad08cec19/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/JavaManagementPage.java#L131-L167","documentation":"JavaManagementPage.onAddJavaHome registers an external JDK directory with HMCL. A valid JDK/JRE installation must contain a `release` metadata file at its root; if file.resolve(\"release\") does not exist, the page throws IOException(\"Missing release file \" + releaseFile) and shows the i18n \"java.add.failed\" dialog.","triggerScenarios":"Using \"Add Java home\" and pointing at a directory that lacks a `release` file at its top level — e.g. the bin/ directory, a folder one level too high, or a stripped JRE image.","commonSituations":"Selecting <jdk>/bin instead of <jdk>; selecting the parent of the JDK; jlink/jpackage-produced minimal images that drop the release file; manually copied JDKs missing metadata files.","solutions":["Select the JDK root directory (the one containing both `bin/` and `release`), not bin/ or its parent","Verify the `release` file exists: ls <chosen-dir>/release","Re-extract the JDK archive if it was unpacked incompletely or files were stripped","Use a full JDK distribution rather than a minimal/custom runtime image"],"exampleFix":"// before\nPath releaseFile = file.resolve(\"release\");\nif (Files.notExists(releaseFile))\n    throw new IOException(\"Missing release file \" + releaseFile);\n// after\n// caller-side guard before invoking onAddJavaHome\nif (file.getFileName().toString().equals(\"bin\"))\n    file = file.getParent(); // user picked <jdk>/bin, walk up to <jdk>","handlingStrategy":"validation","validationCode":"// before calling onAddJavaHome\nif (file.getFileName().toString().equals(\"bin\"))\n    file = file.getParent();\nif (!Files.isRegularFile(file.resolve(\"release\"))) {\n    Controllers.dialog(\"Selected directory has no 'release' file — pick the JDK root folder\");\n    return;\n}","typeGuard":null,"tryCatchPattern":"try {\n    addJavaHome(path);\n} catch (IOException e) {\n    if (e.getMessage().startsWith(\"Missing release file\")) {\n        Controllers.dialog(\"Pick the JDK root directory (contains bin/ and release), not bin/ or its parent\");\n    } else throw e;\n}","preventionTips":["Always select the directory that contains both `bin/` and `release`","Verify the `release` file exists before adding a Java home","Avoid jlink-minimal or manually stripped runtime images"],"tags":["file-not-found","java-home","validation","config"],"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"}