Not as a command, but this information is in the registry:
- Open the key
HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment
- Read the
CurrentVersion REG_SZ
- Open the subkey under
Java Runtime Environment named with the CurrentVersion value
- Read the
JavaHome REG_SZ to get the path
For example on my workstation i have
HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment
CurrentVersion = "1.6"
HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\1.5
JavaHome = "C:\Program Files\Java\jre1.5.0_20"
HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\1.6
JavaHome = "C:\Program Files\Java\jre6"
So my current JRE is in C:\Program Files\Java\jre6