add JDK_HOME, some program use/depend on this env (#164)

This commit is contained in:
Pierre/Long 2021-09-29 21:14:08 +07:00 committed by GitHub
parent c3e13ba6e1
commit 93aed32043
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 0 deletions

View File

@ -10,6 +10,7 @@ function _asdf_java_update_java_home() {
if [[ -n "${java_path}" ]]; then
export JAVA_HOME
JAVA_HOME="$(dirname "$(_asdf_java_absolute_dir_path "${java_path}")")"
export JDK_HOME=${JAVA_HOME}
fi
}

View File

@ -6,5 +6,6 @@ function asdf_update_java_home --on-event fish_prompt
# `builtin realpath` returns $JAVA_HOME/bin/java, so we need two `dirname` calls
# in order to get the correct JAVA_HOME directory
set -gx JAVA_HOME (dirname (dirname "$full_path"))
set -gx JDK_HOME "$JAVA_HOME"
end
end

View File

@ -4,6 +4,7 @@ def asdf_update_java_home() -> None:
$java_path=$(asdf which java)
if len($java_path) > 0:
$JAVA_HOME=$(dirname $(dirname $(realpath $java_path))).rstrip('\n')
$JDK_HOME=$JAVA_HOME
del $java_path
@events.on_chdir

View File

@ -4,6 +4,7 @@ asdf_update_java_home() {
if [[ -n "${java_path}" ]]; then
export JAVA_HOME
JAVA_HOME="$(dirname "$(dirname "${java_path:A}")")"
export JDK_HOME=${JAVA_HOME}
fi
}