Closed ForeverKang closed 2 years ago
The java version check logic is as follows, but it's strange that it works in my environment (mac os). You may first comment the version check logic. BTW, what's your operating environment?
version=11.0.13
if [[ "$version" < "1.8" ]]; then
echo "$version is < 1.8"
else
echo "$version >= 1.8"
fi
The result is:
11.0.13 >= 1.8
Another solution is to transform the version string to digits
version=$("$_java" -version 2>&1 | awk -F '"' '/version/ {print $2}')
version_in_digit=$(echo "$version" | awk -F. '{printf("%03d%03d",$1,$2);}')
if [[ $version_in_digit < 001008 ]]; then
echo "Java version is $version, please make sure java 1.8+ is in the path"
exit 1
fi
我是jdk11版本,但是启动demo.sh的时候报版本不能低于1.8 Java version is 11.0.13, please make sure java 1.8+ is in the path 这个问题如何解决