HMCL-dev/HMCL · error · IOException
Unknown operating system:
Error message
Unknown operating system:
What it means
JavaInfo.fromReleaseFile() parses a JDK's release file and maps the OS_NAME property through OperatingSystem.parseOSName(). If the resulting OS is UNKNOWN (unrecognized os name or missing OS_NAME), it throws IOException("Unknown operating system: <osName>") because HMCL cannot pick a platform for this Java installation.
Solutions
- Check the release file next to the java executable and set OS_NAME to a standard value (Linux/Windows/Mac OS X)
- Use a full official JDK/JRE distribution that ships a proper release file
- Update HMCL, since newer versions may recognize more OS names
- Catch the IOException during Java scan and skip that installation
Defensive patterns
Strategy: try-catch
Validate before calling
Properties rel = new Properties();
rel.load(Files.newInputStream(javaHome.resolve("release")));
String osName = rel.getProperty("OS_NAME");
if (osName == null || OperatingSystem.parseOSName(osName) == OperatingSystem.UNKNOWN) {
skipThisJavaInstallation();
} Try / catch
try {
JavaInfo info = JavaInfo.fromReleaseFile(javaHome);
} catch (IOException e) {
markJavaInvalid(javaHome, e.getMessage()); // skip entry
} Prevention
- Only register Java installations from full official distributions
- Check the release file has OS_NAME before scanning
- Keep HMCL updated for new OS name variants
- Skip (don't fail) unrecognized runtimes during batch scans
When it happens
Trigger: Scanning a Java installation whose release file has an OS_NAME that OperatingSystem.parseOSName does not recognize (typo, exotic distro string, or an empty/absent OS_NAME property, in which case osName is null).
Common situations: Manually built or patched JDK with a missing/modified release file; JREs (like old Java 8) that omit OS_NAME from the release file; custom lightweight runtimes (jlink images) without a release file; non-standard vendor distributions.
Understand the failure class
Background: "unsupported platform" / "not supported on this platform" errors: what they mean and how to fix them — this error's family across 47 libraries.
Related errors
AI-assisted analysis of HMCL-dev/HMCL@24702dc5a0 (2026-09-10).
Data as JSON: /api/errors/351f13b35630d5b5.
Report an issue: GitHub.
Appendix: source
Thrown at HMCLCore/src/main/java/org/jackhuang/hmcl/java/JavaInfo.java:77
return -1;
}
}
public static JavaInfo fromReleaseFile(BufferedReader reader) throws IOException {
Map<String, String> properties = KeyValuePairUtils.loadProperties(reader);
String osName = properties.get("OS_NAME");
String osArch = properties.get("OS_ARCH");
String vendor = properties.get("IMPLEMENTOR");
OperatingSystem os = "".equals(osName) && "OpenJDK BSD Porting Team".equals(vendor)
? OperatingSystem.FREEBSD
: OperatingSystem.parseOSName(osName);
Architecture arch = Architecture.parseArchName(osArch);
String javaVersion = properties.get("JAVA_VERSION");
if (os == OperatingSystem.UNKNOWN)
throw new IOException("Unknown operating system: " + osName);
if (arch == Architecture.UNKNOWN)
throw new IOException("Unknown architecture: " + osArch);
if (javaVersion == null)
throw new IOException("Missing Java version");
return new JavaInfo(Platform.getPlatform(os, arch), javaVersion, vendor);
}
public static <F, E extends ArchiveEntry> JavaInfo fromArchive(ArchiveFileTree<F, E> tree) throws IOException {
if (tree.getRoot().getSubDirs().size() != 1 || !tree.getRoot().getFiles().isEmpty())
throw new IOException();
ArchiveFileTree.Dir<E> jdkRoot = tree.getRoot().getSubDirs().values().iterator().next();
E releaseEntry = jdkRoot.getFiles().get("release");
if (releaseEntry == null)
throw new IOException("Missing release file");View on GitHub (pinned to 24702dc5a0)