scylladb / scylla-tools-java

Apache Cassandra, supplying tools for Scylla
Apache License 2.0
53 stars 85 forks source link

install.sh: introduce Java existance check #401

Open syuu1228 opened 4 months ago

syuu1228 commented 4 months ago

Since we dropped Java check from unified installer and jmx, we need to do it on scylla-tools.

Related https://github.com/scylladb/scylladb/pull/17969

syuu1228 commented 4 months ago

This is part of https://github.com/scylladb/scylladb/pull/17969, need to merge first.

syuu1228 commented 4 months ago

also, in scylla-jmx, select-java actually serves for use cases

in this change, we only address the second use case, where we are installing scylla-tools using install.sh, but what about the first use case? please note, the existing check is performed by

https://github.com/scylladb/scylla-tools-java/blob/01ba3c196f2007dcd1bed3755bd5d392be4f499a/dist/common/cassandra.in.sh#L65

, which just check if the java fulfills the needs, it does not pick a java runtime. so if user actually has openjdk-11 installed, but he/she doe not point /usr/bin/java to it, or export $JAVA so that it points to one of the supported java runtime, cassandra.in.sh fails.

We need some code to detect Java on scylla-tools's install.sh, since we are dropping it from unified installer. But, as you descripbed, Java detection method between select-java and cassandra.in.sh are different, I think we should not use select-java here. So I pushed new code to detect Java just like cassandra.in.sh, and dropped select-java.