I execute the command sudo cassandra -R to start cassandra and I get the following error.
getopt: invalid option -- 'R'
/usr/sbin/cassandra: 158: exec: java: not found
It points to the following line in the cassandra script.
else
exec $NUMACTL "$JAVA" $JVM_OPTS $cassandra_parms -cp "$CLASSPATH"
Is it because the environment variable JAVA is not set?
If yes, how to set the variable?
The output of echo $JAVA_HOME is blank. This is the output of java -version:
java version "1.8.0_161"
Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)
$JAVAset? Please [edit] and provide the output ofecho $JAVAandjava -version. – dessert May 18 '18 at 06:22JAVA=$(which java) && sudo cassandra– let’s see whether it’s as simple as that. :) – dessert May 18 '18 at 06:36