[PR #1730] [MERGED] Launcher: use one compatible JDK for resource preparation #3724

Closed
opened 2026-11-03 04:11:43 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: main ← Head: fix/launcher-java-pairing


📝 Commits (2)

  • 342cb6c Fix Java compiler/runtime selection during preparation
  • 08491bc Java selection: keep Windows JDK homes free of the \?\ prefix

📊 Changes

5 files changed (+357 additions, -53 deletions)

View changed files

📝 crates/horizon-prepare/src/java.rs (+102 -34)
➕ crates/horizon-prepare/tests/java_selection.rs (+133 -0)
➕ crates/horizon-prepare/tests/support/java_probe.rs (+21 -0)
📝 launcher/src/backend.rs (+16 -19)
➕ launcher/src/backend/java_tests.rs (+85 -0)

📄 Description

🤖 Opened by rdbt's AI agent (OpenCode, gpt-6.1-sol).

What and why

A Windows user opening v0.2.50 reported UnsupportedClassVersionError while preparing VanillaHeightmapOracle: the compiled class required Java 25 (class-file version 69), but the selected runtime was Java 21 (class-file version 65).

JDK discovery checked only javac and resolved the compiler and runtime independently on PATH. The launcher also discarded a successful installed-JDK selection, letting an external preparer rediscover incompatible tools.

  • Resolve PATH compiler symlinks to their JDK homes and select the sibling runtime; consider later PATH JDKs when earlier ones are too old.
  • Validate both compiler and runtime versions and their probe exit status.
  • Always forward the selected JDK home to in-process preparation and to external Rust/Python preparers through JAVA_HOME and PATH, covering older installed game versions too.
  • Add process-level regression scenarios for runtime shadowing, an older JDK first on PATH, incompatible JAVA_HOME, failed probes, legacy Java version parsing, a newer compiler paired with the pinned runtime, symlinked tools, and the external-preparer handoff.

The launcher's existing Minecraft-runtime discovery/download fallback now also handles candidates whose compiler is new enough but whose runtime is incompatible.

Vanilla reference

Horizon-only launcher/resource preparation. Failure reference: Horizon's VanillaHeightmapOracle exporter was compiled for class-file version 69, while the Java 21 runtime supported only version 65.

Self-check

pr_ready (tools/pr_ready.py --quick on archlinux, against origin/main at f2f58aca9, 40 s)

Check Result
Scope ✅ 5 files, +323 −53
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ➖ no Python change
rustfmt ✅ (9 s)
clippy ✅ (1 s)
tests: horizon-prepare ✅ 31 passed (7 s)
doc tests ✅ 0 passed (1 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ✅ (1 s)
launcher clippy ✅ (9 s)
launcher tests ✅ 119 passed (4 s)
Parity ➖ 110 affected, to run in CI (--quick): mob_ai, pillar, piston_movement, piston_shape, place_recipe, placement, player_equipment, player_food, player_health, player_hurt, player_inventory, player_sync and 98 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

🤖 Generated with OpenCode (gpt-6.1-sol).


🔄 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/1730 **Author:** [@rdbtCVS](https://github.com/rdbtCVS) **Created:** 10/25/2026 **Status:** ✅ Merged **Merged:** 10/25/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/launcher-java-pairing` --- ### 📝 Commits (2) - [`342cb6c`](https://github.com/horizon-rust/horizon/commit/342cb6c5004c6e56bced5f4446583f24fcdf9fb3) Fix Java compiler/runtime selection during preparation - [`08491bc`](https://github.com/horizon-rust/horizon/commit/08491bcda3433fca20b5e3f0c27e0077df967921) Java selection: keep Windows JDK homes free of the \\?\ prefix ### 📊 Changes **5 files changed** (+357 additions, -53 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-prepare/src/java.rs` (+102 -34) ➕ `crates/horizon-prepare/tests/java_selection.rs` (+133 -0) ➕ `crates/horizon-prepare/tests/support/java_probe.rs` (+21 -0) 📝 `launcher/src/backend.rs` (+16 -19) ➕ `launcher/src/backend/java_tests.rs` (+85 -0) </details> ### 📄 Description > 🤖 Opened by rdbt's AI agent (OpenCode, gpt-6.1-sol). ## What and why A Windows user opening v0.2.50 reported `UnsupportedClassVersionError` while preparing `VanillaHeightmapOracle`: the compiled class required Java 25 (class-file version 69), but the selected runtime was Java 21 (class-file version 65). JDK discovery checked only `javac` and resolved the compiler and runtime independently on PATH. The launcher also discarded a successful installed-JDK selection, letting an external preparer rediscover incompatible tools. - Resolve PATH compiler symlinks to their JDK homes and select the sibling runtime; consider later PATH JDKs when earlier ones are too old. - Validate both compiler and runtime versions and their probe exit status. - Always forward the selected JDK home to in-process preparation and to external Rust/Python preparers through `JAVA_HOME` and PATH, covering older installed game versions too. - Add process-level regression scenarios for runtime shadowing, an older JDK first on PATH, incompatible `JAVA_HOME`, failed probes, legacy Java version parsing, a newer compiler paired with the pinned runtime, symlinked tools, and the external-preparer handoff. The launcher's existing Minecraft-runtime discovery/download fallback now also handles candidates whose compiler is new enough but whose runtime is incompatible. ## Vanilla reference Horizon-only launcher/resource preparation. Failure reference: Horizon's `VanillaHeightmapOracle` exporter was compiled for class-file version 69, while the Java 21 runtime supported only version 65. ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on archlinux, against origin/main at f2f58aca9, 40 s) | Check | Result | | --- | --- | | Scope | ✅ 5 files, +323 −53 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ➖ no Python change | | rustfmt | ✅ (9 s) | | clippy | ✅ (1 s) | | tests: horizon-prepare | ✅ 31 passed (7 s) | | doc tests | ✅ 0 passed (1 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ✅ (1 s) | | launcher clippy | ✅ (9 s) | | launcher tests | ✅ 119 passed (4 s) | | Parity | ➖ 110 affected, to run in CI (--quick): mob_ai, pillar, piston_movement, piston_shape, place_recipe, placement, player_equipment, player_food, player_health, player_hurt, player_inventory, player_sync and 98 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | 🤖 Generated with [OpenCode](https://opencode.ai) (gpt-6.1-sol). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:11:43 +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#3724
No description provided.