What is command to see all java versions installed on linux?

On most Linux distributions you can use update-alternatives like this:

sudo update-alternatives --config java

It will list all packages that provide java command and will let you change it. If you don't want to change it, simply Ctrl-C from it.

There is only one catch - if you installed some java not using official package manager (dpkg/apt-get, rpm/yum), but simply extracted it, update-alternatives will not show it.


You could do:

find / -name java 

To find all files. The package manager with your version of Linux should also be able to list them.


I use this to list the Java installs available:

sudo update-alternatives --display java