Skip to content

Commit 976f6ba

Browse files
authored
Fix java version check in start-rc.sh (#860)
* Fix java version check in start-rc.sh * Use awk instead of grep
1 parent d6a95b3 commit 976f6ba

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

scripts/start-rc.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ hazelcast-enterprise-${HAZELCAST_ENTERPRISE_VERSION}-tests.jar:\
8282
hazelcast-${HAZELCAST_TEST_VERSION}-tests.jar"
8383

8484
# necessary arguments for Java 9+
85-
if ! java -version 2>&1 | grep -E "java version \"1\." > /dev/null; then
85+
JAVA_MAJOR_VERSION=$(java -version 2>&1 | head -n 1 | awk -F '"' '{print $2}' | awk -F '.' '{print $1}')
86+
if [ "$JAVA_MAJOR_VERSION" != "1" ]; then
8687
MODULE_ARGUMENTS="--add-exports java.base/jdk.internal.ref=ALL-UNNAMED --add-opens java.base/java.nio=ALL-UNNAMED"
8788
fi
8889

0 commit comments

Comments
 (0)