How can I find which Java Virtual Machine is running on my computer?

java, jvm

Solution

Running `java -version` will tell you which Java binary is first in your path. This will be the binary used by any applications executed using "`java -jar ...`" or similar.

C:\>java -version
java version "1.7.0_25"
Java(TM) SE Runtime Environment (build 1.7.0_25-b17)
Java HotSpot(TM) Client VM (build 23.25-b01, mixed mode, sharing)

On Unix-based systems you could try "`which java`" to see the binary being used. On Windows you have to infer from the version given or by inspecting the `%PATH%` environment variable manually.

Note that some Java applications are executed via shell scripts and may include an absolute path to a Java binary (which may not match the first `java` binary on your path).

Problem

I'd like to know which JVM is being used when I run a Java program through the command prompt. Is there a CMD command that can do this?

Original source