[GH-ISSUE #8504] [Feature] Discover compatible versioned Homebrew JDKs for Ghidra #6628

Open
opened 2026-11-01 21:12:47 +00:00 by bsakaguchi · 0 comments
Owner

Originally created by @morluto on GitHub (Nov 1, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/8504

Before submitting

  • Searched open and closed issues and pull requests for related proposals.
  • Reviewed contribution scope; no automatic installation or upgrade is proposed.
  • No credentials, private samples, or sensitive target data are included.

Area

Provider or capability discovery

Current limitation

On macOS, automatic Ghidra Java discovery checks unversioned Homebrew openjdk paths but misses an installed compatible openjdk@21. Users can have a working JDK and still receive an unhealthy doctor result until they explicitly set JAVA_HOME.

Observed with Ghidra 12.1.4 on Darwin arm64 / Node 24.22.1 at source 3842809c371a59609f576a9db8f9c492a3f071e6:

rea doctor --provider ghidra --json
# healthy: false; ghidra-java: /usr/bin/java: Java exited 1

JAVA_HOME=/opt/homebrew/opt/openjdk@21/libexec/openjdk.jdk/Contents/Home \
  rea doctor --provider ghidra --json
# healthy: true; 64-bit full JDK 21.0.12.1

Nothing was installed or changed between these calls. Existing remediation mentions the keg-only case, so there is a working recovery; this request improves discovery and the specificity of that advice.

Desired outcome and success criteria

  • Find compatible installed versioned Homebrew JDKs when no JDK was explicitly selected, or clearly explain how to select the detected versioned installation.
  • Validate version, architecture, JDK capabilities and Ghidra's declared bounds before selection; report why a candidate was rejected.
  • Preserve explicit caller JAVA_HOME and PATH choices. Do not install/upgrade Java or invoke a package manager to repair it automatically.
  • Pass the validated Java home consistently into actual provider and verifier launches.

Expected interaction with targets

Read existing files; launch selected Java prerequisite probes. No analysis target, automatic package installation, or configuration writes are required for this proposal.

Verification available so far

Observed results from both real scoped doctor calls. No new full Ghidra analysis or MCP conformance run was performed.

Verification details

GhidraInstallation.ts:510 enumerates only /opt/homebrew/opt/openjdk/... and /usr/local/opt/openjdk/.... It does not discover opt/openjdk@21. This source is unchanged at 53363166f068a21f00a605187e1c3af428aa7d5d.

Proposed checks: installed compatible versioned JDK with no explicit selection, incompatible/wrong-architecture candidates, preserved explicit selections, and an actual analysis with the resulting selected toolchain.

Alternatives and references

Explicit JAVA_HOME works now. Closed #4556 addressed discovery of unversioned Homebrew OpenJDK; this is the remaining versioned-formula case. #8171 separately tracks a verifier dropping the already discovered JDK.

Gradle's toolchain discovery documentation is useful prior art for inspecting candidate JDKs and reporting version, architecture and detection source. This is a design reference, not a proposal to copy Gradle's automatic provisioning behavior or a claim that Gradle specifically supports every Homebrew formula.

Originally created by @morluto on GitHub (Nov 1, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/8504 ### Before submitting - [x] Searched open and closed issues and pull requests for related proposals. - [x] Reviewed contribution scope; no automatic installation or upgrade is proposed. - [x] No credentials, private samples, or sensitive target data are included. ### Area Provider or capability discovery ### Current limitation On macOS, automatic Ghidra Java discovery checks unversioned Homebrew `openjdk` paths but misses an installed compatible `openjdk@21`. Users can have a working JDK and still receive an unhealthy doctor result until they explicitly set `JAVA_HOME`. Observed with Ghidra 12.1.4 on Darwin arm64 / Node 24.22.1 at source `3842809c371a59609f576a9db8f9c492a3f071e6`: ```sh rea doctor --provider ghidra --json # healthy: false; ghidra-java: /usr/bin/java: Java exited 1 JAVA_HOME=/opt/homebrew/opt/openjdk@21/libexec/openjdk.jdk/Contents/Home \ rea doctor --provider ghidra --json # healthy: true; 64-bit full JDK 21.0.12.1 ``` Nothing was installed or changed between these calls. Existing remediation mentions the keg-only case, so there is a working recovery; this request improves discovery and the specificity of that advice. ### Desired outcome and success criteria - Find compatible installed versioned Homebrew JDKs when no JDK was explicitly selected, or clearly explain how to select the detected versioned installation. - Validate version, architecture, JDK capabilities and Ghidra's declared bounds before selection; report why a candidate was rejected. - Preserve explicit caller `JAVA_HOME` and PATH choices. Do not install/upgrade Java or invoke a package manager to repair it automatically. - Pass the validated Java home consistently into actual provider and verifier launches. ### Expected interaction with targets Read existing files; launch selected Java prerequisite probes. No analysis target, automatic package installation, or configuration writes are required for this proposal. ### Verification available so far Observed results from both real scoped doctor calls. No new full Ghidra analysis or MCP conformance run was performed. ### Verification details [`GhidraInstallation.ts:510`](https://github.com/morluto/rea/blob/3842809c371a59609f576a9db8f9c492a3f071e6/src/ghidra/GhidraInstallation.ts#L510) enumerates only `/opt/homebrew/opt/openjdk/...` and `/usr/local/opt/openjdk/...`. It does not discover `opt/openjdk@21`. This source is unchanged at `53363166f068a21f00a605187e1c3af428aa7d5d`. Proposed checks: installed compatible versioned JDK with no explicit selection, incompatible/wrong-architecture candidates, preserved explicit selections, and an actual analysis with the resulting selected toolchain. ### Alternatives and references Explicit `JAVA_HOME` works now. Closed #4556 addressed discovery of unversioned Homebrew OpenJDK; this is the remaining versioned-formula case. #8171 separately tracks a verifier dropping the already discovered JDK. Gradle's [toolchain discovery documentation](https://docs.gradle.org/current/userguide/toolchains.html#sec:auto_detection) is useful prior art for inspecting candidate JDKs and reporting version, architecture and detection source. This is a design reference, not a proposal to copy Gradle's automatic provisioning behavior or a claim that Gradle specifically supports every Homebrew formula.
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
morluto/rea#6628
No description provided.