halcyon/asdf-java

Missing lib/utils.bash

Closed this issue · 6 comments

asdf install java corretto-8.322.06.1
/Users/me/.asdf/plugins/java/bin/install: line 3: /Users/me/.asdf/lib/utils.bash: No such file or directory
❯ asdf info
OS:
Darwin 5c52309d33e3 20.6.0 Darwin Kernel Version 20.6.0: Wed Jan 12 22:22:42 PST 2022; root:xnu-7195.141.19~2/RELEASE_X86_64 x86_64

SHELL:
zsh 5.8 (x86_64-apple-darwin20.0)

ASDF VERSION:
v0.9.0

ASDF ENVIRONMENT VARIABLES:


ASDF INSTALLED PLUGINS:
java                         https://github.com/halcyon/asdf-java.git master b0341fd

I had a similar issue.

In my case it was because the plugin install scripts are written for bash, and I use fish (and sometimes zsh) as my shell.

The fix for me was to create a .bash_profile to initialise path information and this line for setting the ASDF_DIR:

set ASDF_DIR "$(brew --prefix asdf)/libexec"

ASDF itself works for me, this problem is exclusive to the Java plugin. I was able to install and configure nodejs just fine.

If it helps: I have this problem on an M1 mac.

I can confirm that the java plugin doesn't work with Fish
And that it can be fixed with this diff inspired by @aboy021

# file: .asdf/plugins/java/bin/list-legacy-filenames
# shellcheck source=/dev/null
+ export ASDF_DIR="$(brew --prefix asdf)"
source "${ASDF_DIR:-$HOME/.asdf}/lib/utils.bash"

I have a similar issue on my M1 Mac:

/Users/xxxxxxx/.asdf/plugins/java/bin/list-legacy-filenames: line 3: /Users/xxxxxxx/.asdf/lib/utils.bash: No such file or directory
  • asdf is installed with brew
  • I use zsh (https://ohmyz.sh/)
  • I installed java with this command: asdf install java openjdk-19.0.1
  • /usr/libexec/java_home returns /opt/homebrew/Cellar/openjdk/19/libexec/openjdk.jdk/Contents/Home (not sure if relevant, but added to clarify this as well)

The homebrew already explain what should be done brew info asdf:

==> Caveats
To use asdf, add the following line (or equivalent) to your shell profile
e.g. ~/.profile or ~/.zshrc:
  . /home/linuxbrew/.linuxbrew/opt/asdf/libexec/asdf.sh
Restart your terminal for the settings to take effect.

But if you are a https://github.com/asdf-community/asdf-direnv user, I suggest the solution:

export ASDF_DIR="$(brew --prefix asdf)/libexec"
export ASDF_DATA_DIR="$HOME/.asdf"