mise-plugins / rtx-java

A Java plugin for rtx.
MIT License
2 stars 0 forks source link

Failed to locate JAVA_HOME when using `/usr/libexec/java_home` #6

Open sh-cho opened 1 year ago

sh-cho commented 1 year ago

Describe the bug

$ echo $JAVA_HOME
/Users/vince/.local/share/rtx/installs/java/temurin-17.0.8+7

$ /usr/libexec/java_home
The operation couldn’t be completed. Unable to locate a Java Runtime.
Please visit http://www.java.com for information on installing Java.

I have installed rtx-java plugin. $JAVA_HOME has been set, but /usr/libexec/java_home is failed to locate JAVA_HOME.

FYI, asdf-java's macOS integration was working (https://github.com/halcyon/asdf-java#java_home-integration) but it slows my entire shell 😞

To Reproduce

rtx plugin add java
rtx install java@temurin-17.0.8+7
rtx use -g java@temurin-17.0.8+7

rtx doctor output

$ rtx doctor
rtx version:
  1.35.7 macos-arm64 (unknown 2023-07-30)

build:
  Target: aarch64-apple-darwin
  Features: BREW, DEFAULT, NATIVE_TLS
  Built: Sun, 30 Jul 2023 23:56:12 +0000
  Rust Version: rustc 1.71.0 (8ede3aae2 2023-07-12) (built from a source tarball)
  Profile: release

shell:
  /bin/zsh
  zsh 5.8.1 (x86_64-apple-darwin22.0)

rtx data directory:
  /Users/vince/.local/share/rtx

rtx environment variables:
  RTX_SHELL=zsh

settings:
  {"always_keep_download": "false", "always_keep_install": "false", "asdf_compat": "false", "disable_default_shorthands": "false", "disable_tools": "[]", "experimental": "false", "jobs": "4", "legacy_version_file": "true", "legacy_version_file_disable_tools": "[]", "log_level": "INFO", "missing_runtime_behavior": "warn", "plugin_autoupdate_last_check_duration": "10080", "raw": "false", "trusted_config_paths": "[]", "verbose": "false"}

config files:
  /Users/vince/.config/rtx/config.toml

plugins:
  go       (core)
  java     https://github.com/rtx-plugins/rtx-java.git#b881802
  node     (core)
  python   (core)
  ruby     (core)
  rust     https://github.com/code-lever/asdf-rust.git#95acf4f

toolset:
  java@temurin-17.0.8+7, rust@1.71.0

No problems found

Additional context Add any other context about the problem here.

jdx commented 1 year ago

yeah I need to replicate this functionality: https://github.com/halcyon/asdf-java/blob/8fcd78b299a3405eaae326fb37aa823ee04a5cd5/bin/functions#L235C30-L239