Is there any command which would list down all the JRE versions and releases installed on a system?
Um...
find / -name "java" -print
on *nix.
Not given any other relaxations, this is the only way (and yes, this is ugly).
On Windows, it looks like all of the installations are recorded in the HKEY_LOCAL_MACHINE/Software/JavaSoft/Java Runtime Environment registry key.
On ubuntu and some other linuxes they're mostly in /usr/lib/jvm. You can also check with
for x in $(echo $PATH | tr ':' ' '); do ls -asl $x | grep java; done
which will also show you all the pretty softlinks. There's probably a nicer way to do this that hopefully some kind person will post :)
If you're on Linux, you can investigate the alternatives
command, if your distribution uses it. The alternatives for java (I think available by typing alternatives java
, but check the man page for details) will list all the installed JREs and point out which one is the current system default. It also lets you easily switch between different versions.
To list all the registered JRE (in a file called "jre.txt") on a Windows machine :
start /w regedit /e jre.txt
"HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment"