For a new issued VM with OS CentOS7, if you executed "java -version" and found returned with "cmd not found" error, that denotes you don't have a jdk on your VM.
It's very simple to install JDK on centos7. Here is the steps.
1 download install packet on the Oracle website: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html, download the jdk-8u181-linux-x64.tar.gz, remember probabaly you can't unzip it if you download directly by "wget" cmd, in this case you just need to download manually and push the file on the server. The reason for doing this is you must accept the agreement before you download the jdk file and wget can't do that.
2 unzip the file with cmd "tar -xvf jdk-8u181-linux-x64.tar.gz", and you will get a folder "jdk1.8.0_181".
3 move that folder under "/usr/local" with "mv jdk1.8.0_181 /usr/local"
4 the last step is add the JAVA into the PATH, you may cd root directory, vim .bash_profile, and add these into it.
source .bash_profile to get this config taking effect, now you exe "java -version" and you will see the jdk version.