If java is already installed on your machine, you can generally just type
java -version
assuming that where it’s installed is part of your PATH.
If you don’t know where it’s installed and it’s not part of your path, you can use a few different options to attempt to locate it.
1. Check to see if was installed as an RPM.
rpm -qlv jdk | grep bin/java
2. Use the “locate” command.
locate bin/java
The resulting output will be something similar to:
# /usr/local/java/jdk1.6.0_18/bin/java -version
java version “1.6.0_18”
Java(TM) SE Runtime Environment (build 1.6.0_18-b07)
Java HotSpot(TM) Client VM (build 16.0-b13, mixed mode, sharing)