New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JAVA_HOME did not get updated #51
Comments
You'll need to restart your shell for JAVA_HOME to be updated. |
@halcyon Yes, that is the issue, I should not, right? :) |
@jonatan-ivanov I think there's currently no hook in asdf which will invoke a plugin when a version was selected ( |
@joschi I'm not very familiar with asdf but isn't |
@jonatan-ivanov It's not that it couldn't be added to asdf, but this hook doesn't exist right now, so there's nothing asdf-java could do about it. It has to be added in asdf first. Related issue: asdf-vm/asdf#384 |
@joschi Thank you very much! |
I live with this in my function asdf_update_java_home {
asdf current java 2>&1 > /dev/null
if [[ "$?" -eq 0 ]]
then
export JAVA_HOME=$(asdf where java)
fi
}
function prompt_command {
__vte_prompt_command # put here whatever previous PROMPT_COMMAND value
asdf_update_java_home
}
export PROMPT_COMMAND=prompt_command Maybe you could add this to the README while the hook is not there. |
Zsh users can add this to # set JAVA_HOME on every change directory
function asdf_update_java_home {
asdf current java 2>&1 > /dev/null
if [[ "$?" -eq 0 ]]
then
export JAVA_HOME=$(asdf where java)
fi
}
precmd() { asdf_update_java_home; }
# end set JAVA_HOME Also, suggest to add it to the README. |
@halcyon do you prefer a PR adding those to the readme? I could do it. |
@rubencaro @donbeave Be aware that it can substantially slow down your shell when |
@joschi is this something the |
I didn't notice any effect after months using it like that. You should take into account that this will call Maybe it would be enough to add a warning for that specific usecase (i.e. if somebody needs to render the prompt many times per second ?). |
@rubencaro You're right. I mixed up For reference: https://github.com/rothgar/mastering-zsh/blob/master/docs/config/hooks.md#hooks |
@rubencaro @donbeave @joschi @jonatan-ivanov - how would you feel about #76 ? |
@halcyon How about my solution? It worked with both
https://github.com/thuandt/zsh-config/blob/master/functions.sh#L3-L7 |
@halcyon LGTM, I just tested |
If I switch between java versions,
JAVA_HOME
did not get updated.The text was updated successfully, but these errors were encountered: