From fb252ab5aa8474c401af631f20dda936a31c7c22 Mon Sep 17 00:00:00 2001 From: dantengsky Date: Thu, 16 Jun 2022 20:10:09 +0800 Subject: [PATCH] dev_setup.sh: export JAVA_HOME --- scripts/setup/dev_setup.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/scripts/setup/dev_setup.sh b/scripts/setup/dev_setup.sh index a23dcdd579be..88b34f30d574 100755 --- a/scripts/setup/dev_setup.sh +++ b/scripts/setup/dev_setup.sh @@ -198,7 +198,7 @@ function install_jdk { case "$PACKAGE_MANAGER" in apt-get) - install_pkg openjdk-11-jre-headless "$PACKAGE_MANAGER" + install_pkg openjdk-11-jdk-headless "$PACKAGE_MANAGER" ;; pacman) install_pkg jre11-openjdk-headless "$PACKAGE_MANAGER" @@ -220,6 +220,16 @@ function install_jdk { exit 1 ;; esac + + JAVA_HOME=$(readlink -f `which javac` | sed "s:/bin/javac::") + + if [[ -z ${JAVA_HOME} ]]; + then + echo "JAVA_HOME not found" + else + echo "set JAVA_HOME to: $JAVA_HOME" + add_to_profile "export JAVA_HOME=\"${JAVA_HOME}\"" + fi } function install_pkg_config {