To see all installed Java Runtime Environments on your Mac, you may use the following terminal command:
/usr/libexec/java_home -V
The above command will show the installed Java versions and their paths.
Explanation
It is utility locates Java installations on your mac, found at /usr/libexec/java_home.
-V Print all installed versions of Java on your system