asdf-java
asdf-java copied to clipboard
set-java-home.bash requires PWD change?
Curious why this was changed to only update JAVA_HOME if PWD has changed. Maybe I'm doing something wrong but I'm trying to do this:
asdf global java adoptopenjdk-8.0.275+1.openj9-0.23.0
. ~/.asdf/plugins/java/set-java-home.bash
the path changes, so java-version shows 1.8, but JAVA_HOME does not change because I haven't changed directories.
Use case is something like this:
- change to my project directory
- run maven/java command
- "crap, this one requires jdk 8, not 11"
- run commands above to switch to jdk 8
- JAVA_HOME is not changed and command still fails
same issue
looks like it was designed that way
// the code from `~/.asdf/plugins/java/set-java-home.bash`
function _asdf_java_prompt_command() {
if [[ "${PWD}" == "${LAST_PWD}" ]]; then
return
fi
LAST_PWD="${PWD}"
_asdf_java_update_java_home
}
same issue
looks like it was designed that way
// the code from `~/.asdf/plugins/java/set-java-home.bash` function _asdf_java_prompt_command() { if [[ "${PWD}" == "${LAST_PWD}" ]]; then return fi LAST_PWD="${PWD}" _asdf_java_update_java_home }
Removing check condition seems to work, but I'm not sure if it makes sense
function _asdf_java_prompt_command() {
#if [[ "${PWD}" == "${LAST_PWD}" ]]; then
# return
#fi
#LAST_PWD="${PWD}"
_asdf_java_update_java_home
}