mirror of
https://github.com/halcyon/asdf-java.git
synced 2024-10-05 23:32:11 +08:00
add JDK_HOME, some program use/depend on this env (#164)
This commit is contained in:
parent
c3e13ba6e1
commit
93aed32043
@ -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
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user