[PR #3386] [MERGED] Launcher: Java runtimes for Minecraft: Java Edition instances #4945

Closed
opened 2026-11-03 05:09:06 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/3386
Author: @ludovic111
Created: 10/28/2026
Status: ✅ Merged
Merged: 10/28/2026
Merged by: @ludovic111

Base: main ← Head: feat/launcher-java-runtimes


📝 Commits (1)

  • 228af35 Launcher: Java runtimes for Minecraft: Java Edition instances

📊 Changes

6 files changed (+465 additions, -1 deletions)

View changed files

📝 launcher/README.md (+8 -0)
📝 launcher/src/backend.rs (+1 -1)
📝 launcher/src/cli.rs (+52 -0)
➕ launcher/src/java.rs (+275 -0)
➕ launcher/src/java/tests.rs (+128 -0)
📝 launcher/src/lib.rs (+1 -0)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

What and why

This is the first piece of Minecraft: Java Edition instances (vanilla, then Fabric, Quilt, NeoForge and Forge). It works out which Java a version needs and where that Java comes from, as other launchers do. The real game wants the exact major its version JSON names: older versions and their loaders often fail on a newer Java. So the launcher never picks a newer Java by itself; it downloads Mojang's runtime instead.

Changes (launcher/src/java.rs, new)

  • Need::of(version_json): javaVersion.majorVersion and component (java-runtime-delta for 1.21). Versions from before that field ran Java 8 (jre-legacy). Need::named("21" | "java-runtime-delta") handles a typed major or component.
  • Finding runtimes without starting them: each Java home's release file gives its version (JAVA_VERSION="21.0.5", Java 8's 1.8.0_432 included).
    • mojang_runtimes: Mojang's runtimes Horizon downloaded. They live in minecraft/runtime/ in the launcher's data folder, the folder preparing already uses, in Mojang's layout, with macOS's jre.bundle.
    • installed: JAVA_HOME, the PATH's java, and the usual installer folders (/Library/Java/JavaVirtualMachines, /usr/lib/jvm, Program Files vendors, ~/.jdks, SDKMAN), each listed once.
  • pick(need, chosen, mojang, installed): the instance's own Java home when it names one, else the exact major (Mojang's first), else None, meaning Mojang's runtime is to be downloaded.
  • install(need): downloads Mojang's runtime with the existing mojang::java_runtime (each file sha1-checked, resumable). On Linux x86-64 without glibc's loader it refuses, as preparing does (GLIBC_LOADER is now pub(crate)).
  • CLI: horizon-launcher java [list] and java install <8|16|17|21|25|component>, both with --json.
  • launcher/README.md: a Java bullet and the commands.

Instances' own Java settings (home, memory, JVM arguments) come with the Java instance model in the next PR. The UI comes with the redesign (Settings → Java, instance settings).

Tested

  • 7 new unit tests on fixture Java homes in temp dirs: what a version needs (and Java 8 for old ones), release parsing (21.0.5, 1.8.0_432, 25, 17.0.12+7), Mojang's layout with macOS's bundle, the pick order (exact major, Mojang's first, never newer, an instance's own home, a wrong folder's error), typed names.
  • By hand, in fresh mktemp -d homes on macOS arm64:
    • java list found the installed Temurin 25.
    • java install 21 downloaded Mojang's java-runtime-delta (145 files) into the scratch launcher home; java list then showed it as Mojang's.
    • Its bin/java -version printed openjdk version "21.0.7".
  • On the Mac mini, account::tests::the_whole_chain sometimes fails, with an extra GET / on its mock server's fresh 127.0.0.1 port. A local process probes new ports; this change doesn't touch accounts or networking, and the run below is green.

pr_ready (tools/pr_ready.py --quick on ludovics-mac-mini, against origin/main at 3782473f5, 7 min 14 s)

Check Result
Scope ✅ 6 files, +465 −1
Cargo.lock ✅ unchanged
Public tree ✅ (1 s)
Python tests ✅ 405 passed (6 min 50 s)
rustfmt ➖ no Rust change
clippy ➖ no Rust change
tests ➖ no crate touched
doc tests ➖ no crate touched
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ✅ (9 s)
launcher clippy ✅ (4 s)
launcher tests ✅ 233 passed (8 s)
Parity ➖ 1 affected, to run in CI (--quick): lan_integration
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

Label: feature.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/3386 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/28/2026 **Status:** ✅ Merged **Merged:** 10/28/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/launcher-java-runtimes` --- ### 📝 Commits (1) - [`228af35`](https://github.com/horizon-rust/horizon/commit/228af35f2af114104c714d50096801d8258524e2) Launcher: Java runtimes for Minecraft: Java Edition instances ### 📊 Changes **6 files changed** (+465 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `launcher/README.md` (+8 -0) 📝 `launcher/src/backend.rs` (+1 -1) 📝 `launcher/src/cli.rs` (+52 -0) ➕ `launcher/src/java.rs` (+275 -0) ➕ `launcher/src/java/tests.rs` (+128 -0) 📝 `launcher/src/lib.rs` (+1 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. ## What and why This is the first piece of Minecraft: Java Edition instances (vanilla, then Fabric, Quilt, NeoForge and Forge). It works out which Java a version needs and where that Java comes from, as other launchers do. The real game wants the exact major its version JSON names: older versions and their loaders often fail on a newer Java. So the launcher never picks a newer Java by itself; it downloads Mojang's runtime instead. ## Changes (`launcher/src/java.rs`, new) - `Need::of(version_json)`: `javaVersion.majorVersion` and `component` (`java-runtime-delta` for 1.21). Versions from before that field ran Java 8 (`jre-legacy`). `Need::named("21" | "java-runtime-delta")` handles a typed major or component. - **Finding runtimes without starting them:** each Java home's `release` file gives its version (`JAVA_VERSION="21.0.5"`, Java 8's `1.8.0_432` included). - `mojang_runtimes`: Mojang's runtimes Horizon downloaded. They live in `minecraft/runtime/` in the launcher's data folder, the folder preparing already uses, in Mojang's layout, with macOS's `jre.bundle`. - `installed`: JAVA_HOME, the PATH's `java`, and the usual installer folders (`/Library/Java/JavaVirtualMachines`, `/usr/lib/jvm`, Program Files vendors, `~/.jdks`, SDKMAN), each listed once. - `pick(need, chosen, mojang, installed)`: the instance's own Java home when it names one, else the exact major (Mojang's first), else `None`, meaning Mojang's runtime is to be downloaded. - `install(need)`: downloads Mojang's runtime with the existing `mojang::java_runtime` (each file sha1-checked, resumable). On Linux x86-64 without glibc's loader it refuses, as preparing does (`GLIBC_LOADER` is now `pub(crate)`). - CLI: `horizon-launcher java [list]` and `java install <8|16|17|21|25|component>`, both with `--json`. - `launcher/README.md`: a Java bullet and the commands. Instances' own Java settings (home, memory, JVM arguments) come with the Java instance model in the next PR. The UI comes with the redesign (Settings → Java, instance settings). ## Tested - 7 new unit tests on fixture Java homes in temp dirs: what a version needs (and Java 8 for old ones), `release` parsing (21.0.5, 1.8.0_432, 25, 17.0.12+7), Mojang's layout with macOS's bundle, the pick order (exact major, Mojang's first, never newer, an instance's own home, a wrong folder's error), typed names. - By hand, in fresh `mktemp -d` homes on macOS arm64: - `java list` found the installed Temurin 25. - `java install 21` downloaded Mojang's java-runtime-delta (145 files) into the scratch launcher home; `java list` then showed it as Mojang's. - Its `bin/java -version` printed `openjdk version "21.0.7"`. - On the Mac mini, `account::tests::the_whole_chain` sometimes fails, with an extra `GET /` on its mock server's fresh 127.0.0.1 port. A local process probes new ports; this change doesn't touch accounts or networking, and the run below is green. **pr_ready** (`tools/pr_ready.py --quick` on ludovics-mac-mini, against origin/main at 3782473f5, 7 min 14 s) | Check | Result | | --- | --- | | Scope | ✅ 6 files, +465 −1 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ (1 s) | | Python tests | ✅ 405 passed (6 min 50 s) | | rustfmt | ➖ no Rust change | | clippy | ➖ no Rust change | | tests | ➖ no crate touched | | doc tests | ➖ no crate touched | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ✅ (9 s) | | launcher clippy | ✅ (4 s) | | launcher tests | ✅ 233 passed (8 s) | | Parity | ➖ 1 affected, to run in CI (--quick): lan_integration | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | Label: `feature`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:09:06 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#4945
No description provided.