Skip to content

running .asdf/plugins/java/set-java-home.zsh on mac fails #254

Description

@sgandon

when runnin the set-java-home.szh on my mac I get this

/Users/xxx/.asdf/plugins/java/set-java-home.zsh
/Users/xxx/.asdf/plugins/java/set-java-home.zsh: line 11: autoload: command not found
/Users/xxx/.asdf/plugins/java/set-java-home.zsh: line 12: add-zsh-hook: command not found

I fixed the issue by adding the shebang (#!/bin/zsh)

#!/bin/zsh       <-----------------------added this to fix the issue
asdf_update_java_home() {
  local java_path
  java_path="$(asdf which java)"
  if [[ -n "${java_path}" ]]; then
    export JAVA_HOME
    JAVA_HOME="$(dirname "$(dirname "${java_path:A}")")"
    export JDK_HOME=${JAVA_HOME}
  fi
}

autoload -U add-zsh-hook
add-zsh-hook precmd asdf_update_java_home

Do you want me to create a PR for this ?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions