HMCL-dev/HMCL · error · IOException
Unknown architecture:
Error message
Unknown architecture:
What it means
JavaInfo.fromReleaseFile() maps the OS_ARCH property via Architecture.parseArchName(). When the architecture is not recognized (Architecture.UNKNOWN), it throws IOException("Unknown architecture: <osArch>") because there is no matching Platform combining OS and architecture.
Solutions
- Update HMCL to a version whose Architecture.parseArchName supports this architecture string
- Edit the release file's OS_ARCH to a canonical value (e.g. x86_64, aarch64) if you control the distribution
- Use an officially supported Java build for your platform instead
- Catch the IOException in the Java scan and exclude this runtime
Defensive patterns
Strategy: try-catch
Validate before calling
Properties rel = new Properties();
rel.load(Files.newInputStream(javaHome.resolve("release")));
String arch = rel.getProperty("OS_ARCH");
if (arch == null || Architecture.parseArchName(arch) == Architecture.UNKNOWN) {
skipThisJavaInstallation();
} Try / catch
try {
JavaInfo info = JavaInfo.fromReleaseFile(javaHome);
} catch (IOException e) {
skipUnsupportedArch(javaHome); // continue scan
} Prevention
- Prefer standard JDK builds with canonical OS_ARCH values (x86_64, aarch64)
- Update HMCL when running on emerging architectures
- Sanitize the release file if you control custom builds
- Treat unknown-arch runtimes as non-candidates in the Java list
When it happens
Trigger: A Java installation whose release file has an OS_ARCH value not handled by Architecture.parseArchName (e.g. unusual casing/spelling, riscv/loongarch builds on an older HMCL, or missing OS_ARCH giving null).
Common situations: Running niche or newly released architectures (riscv64, loongarch64) on an older launcher that doesn't know them; custom-built JDKs with a nonstandard OS_ARCH string; package-manager JREs with odd arch labels.
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
- Unknown operating system:
- Candidates
- Missing Java version
- Platform is mismatch: expected
- Unsupported platform
AI-assisted analysis of HMCL-dev/HMCL@24702dc5a0 (2026-09-10).
Data as JSON: /api/errors/4eccb7816989f248.
Report an issue: GitHub.
Appendix: source
Thrown at HMCLCore/src/main/java/org/jackhuang/hmcl/java/JavaInfo.java:80
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");
JavaInfo info;
try (BufferedReader reader = new BufferedReader(new InputStreamReader(tree.getInputStream(releaseEntry), StandardCharsets.UTF_8))) {View on GitHub (pinned to 24702dc5a0)