Closed BFMeenink closed 3 years ago
Seeing your output it seems you changed the dirname
command to a ls -al
command.
What happens if you do:
/usr/bin/dirname /Users/bremeeni/.asdf/installs/java/adoptopenjdk-8.0.282+8.openj9-0.24.0/bin
. For me that results in:
❯ /usr/bin/dirname /Users/bremeeni/.asdf/installs/java/adoptopenjdk-8.0.282+8.openj9-0.24.0/bin
/Users/bremeeni/.asdf/installs/java/adoptopenjdk-8.0.282+8.openj9-0.24.0
If this makes the output the same for you, you could replace the 2 dirname
s in set-java-home.zsh to /usr/bin/dirname
.
Sorry for not replying for so long, I somehow did not get a notification and have solved the issue in the mean time.
In my .zshrc there's function chpwd () { pwd && ls -FGlahp }
.
I've solved the issue by using something very similar to what you suggested and the set-java-home in general:
function asdf_update_java_home {
asdf current java 2>&1 > /dev/null
if [[ "$?" -eq 0 ]]
then
export JAVA_HOME=$(asdf where java)
fi
}
autoload -U add-zsh-hook
add-zsh-hook precmd asdf_update_java_home
Description
Using asdf-java, with version
adoptopenjdk-8.0.282+8.openj9-0.24.0
, in zsh. When I add. ~/.asdf/plugins/java/set-java-home.zsh
to~/.zshrc
I get file name too long errors and java_home is not set.Environment
echo $0
->zsh
echo $SHELL
->/bin/zsh
asdf --version
->v0.8.0
asdf plugin list --urls --refs
->java https://github.com/halcyon/asdf-java.git master be57a70
cat ~/.asdfrc
->java_macos_integration_enable = yes
Steps taken
adoptopenjdk-8.0.282+8.openj9-0.24.0
in my case:asdf install java adoptopenjdk-8.0.282+8.openj9-0.24.0
~/.zhsrc
. ~/.asdf/plugins/java/set-java-home.zsh
as final line. ~/.asdf/plugins/java/set-java-home.zsh
Expected
Actual
is output; for each and every statement executed from then onwards.
Temporary fix/workaround
export JAVA_HOME=$(/usr/libexec/java_home)
Am I missing something?