Bash command to check if Oracle or OpenJDK java version is installed on Linux
if [[ $(java -version 2>&1) == *"OpenJDK"* ]]; then echo ok; else echo 'not ok'; fi
java -version 2>&1 | grep "OpenJDK Runtime" | wc -l
returns 0 if using Oracle JDK, 1 if using OpenJDK
Bash condition:
if [[ $(java -version 2>&1 | grep "OpenJDK Runtime") ]]