diff options
author | Leigh McCulloch <leigh@mcchouse.com> | 2019-02-18 01:52:55 +0000 |
---|---|---|
committer | George Fraser <george@fivetran.com> | 2019-02-18 15:15:11 -0800 |
commit | 7c049ce72332a99e9f062b44b2c31b59efe8a067 (patch) | |
tree | 7400445d6d10386c6fd4b0fe1b335e38d3a878dd | |
parent | e567bb0507f48f0558a056f4244b28b26731f0d2 (diff) | |
download | java-language-server-7c049ce72332a99e9f062b44b2c31b59efe8a067.zip |
Error if java binary doesn't exist
-rwxr-xr-x | scripts/check_java_home.sh | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/scripts/check_java_home.sh b/scripts/check_java_home.sh index da6113c..36caffe 100755 --- a/scripts/check_java_home.sh +++ b/scripts/check_java_home.sh @@ -4,15 +4,20 @@ set -e if [[ -z "${JAVA_HOME}" ]]; then - echo "error: JAVA_HOME must be set" + echo "JAVA_HOME must be set" exit 1 fi echo "JAVA_HOME is set to: $JAVA_HOME" +if [ ! -f "$JAVA_HOME/bin/java" ]; then + echo "JAVA_HOME does not point to an installation of Java" + exit 1 +fi + java_version=$("$JAVA_HOME/bin/java" -version 2>&1 | sed -n ';s/.* version "\(.*\)\.\(.*\)\..*".*/\1/p;') echo "JAVA_HOME version is: $java_version" if [ "$java_version" -ne 11 ]; then - echo "error: JAVA_HOME must be set to a JDK version 11" + echo "JAVA_HOME must be set to a JDK version 11" exit 1 fi |