tags:

views:

225

answers:

5

Is there any command which would list down all the JRE versions and releases installed on a system?

+1  A: 

Um...

find / -name "java" -print

on *nix.

Not given any other relaxations, this is the only way (and yes, this is ugly).

Yuval A
A: 

On Windows, it looks like all of the installations are recorded in the HKEY_LOCAL_MACHINE/Software/JavaSoft/Java Runtime Environment registry key.

Outlaw Programmer
+1  A: 

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 :)

Steve B.
Gentoo has a program, java-config, that can list all installed VMs, but I don't know of anything better than your command that works for all kinds of Linux.
David Zaslavsky
A: 

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.

rmeador
+3  A: 

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"
RealHowTo