Hi Paul
If you have already installed java. you have to set JAVA_HOME variable.
You can use below command to do that
export JAVA_HOME=$(dirname $(dirname $(readlink $(readlink $(which java)))))
export PATH=$PATH:$JAVA_HOME/bin
To confirm that you've done it correctly run this command:
echo $JAVA_HOME
The output off command should be something like:
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.282.b08-1.el7_9.x86_64/jre