Fix compilation error because of vague JDK version check in compile.sh
Fixes:
MOS_MIGRATED_REVID=150754975
@@ -65,9 +65,15 @@ LDFLAGS=${LDFLAGS:-""}
MSYS_DLLS=""
-# Check that javac -version returns a upper version than $JAVA_VERSION.
+function get_minor_java_version() {
get_java_version
-[ ${JAVA_VERSION#*.} -le ${JAVAC_VERSION#*.} ] || \
+ java_minor_version=$(echo $JAVA_VERSION | sed -E 's/.+\.(.+)(\..*)?/\1/')
+ javac_minor_version=$(echo $JAVAC_VERSION | sed -E 's/.+\.(.+)(\..*)?/\1/')
+}
+
+# Check that javac -version returns a upper version than $JAVA_VERSION.
+get_minor_java_version
+[ ${java_minor_version} -le ${javac_minor_version} ] || \
fail "JDK version (${JAVAC_VERSION}) is lower than ${JAVA_VERSION}, please set \$JAVA_HOME."
JAR="${JAVA_HOME}/bin/jar"
