See all the Java versions installed on Mac

How can I get all the Java versions installed on my Mac?

Is there a terminal command for this?

When I run java -version, I get the current JRE version that is in use in my system, but I want to list all the JREs installed on my Mac.


Solution 1:

/usr/libexec/java_home -V

lists one line per Java environment installed (and known to the /usr/bin/java command).

You can still have other Java distributions which are not registered. They are typically downloaded as ZIP files without an installer.