How to jvm version

Content on WhatAnswers is provided "as is" for informational purposes. While we strive for accuracy, we make no guarantees. Content is AI-assisted and should not be used as professional advice.

Last updated: April 4, 2026

Quick Answer: To check your JVM version, open your command prompt or terminal and type `java -version`. The output will display the Java Runtime Environment (JRE) version, which includes the JVM version. If you need to check the version of a specific Java Development Kit (JDK) installation, you can use `javac -version`.

Key Facts

What is the JVM?

The Java Virtual Machine (JVM) is an abstract computing machine that can execute a program written in the Java programming language. It is a specification that provides a runtime environment in which Java bytecode can be executed. The JVM is the component that actually runs the Java code. It's a crucial part of the Java platform, acting as a bridge between compiled Java code (bytecode) and the underlying hardware and operating system. Different operating systems and hardware architectures require different JVM implementations.

Why is it Important to Know Your JVM Version?

Knowing your JVM version is essential for several reasons:

How to Check Your JVM Version

Checking your JVM version is a straightforward process that can be done directly from your command line interface (CLI) or terminal.

Using the Command Prompt/Terminal

This is the most common and direct method. Ensure you have Java installed and that its `bin` directory is added to your system's PATH environment variable. If Java is not in your PATH, you will need to navigate to the `bin` directory of your Java installation or provide the full path to the `java` executable.

  1. Open your Command Prompt (Windows) or Terminal (macOS/Linux).
  2. Type the following command and press Enter:
    java -version

The output will typically look something like this:

java version "1.8.0_291"
Java(TM) SE Runtime Environment (build 1.8.0_291-b10)
Java HotSpot(TM) 64-Bit Server VM (build 25.291-b10, mixed mode)

In this example, the JVM version is part of the JRE information. The core version is often indicated by the major version number (e.g., '1.8' for Java 8, '11' for Java 11, '17' for Java 17).

Checking the Java Compiler (JDK) Version

If you are a developer and need to check the version of the Java Development Kit (JDK) installed, which includes the Java compiler (`javac`), you can use a similar command:

  1. Open your Command Prompt (Windows) or Terminal (macOS/Linux).
  2. Type the following command and press Enter:
    javac -version

The output will show the compiler version, for instance:

javac 11.0.12

This indicates that the installed JDK is version 11.0.12.

Understanding Java Versioning

Java versioning can sometimes be confusing due to the different ways versions are presented. Historically, Java versions were presented as '1.x.y' (e.g., 1.8). Starting with Java 9, the versioning scheme changed to a more straightforward 'major.minor.security' format (e.g., 9, 10, 11, 17).

When you run `java -version`, you might see both the '1.x.y' and the primary version number. For example, 'Java 1.8.0' corresponds to Java 8.

Troubleshooting Common Issues

'java' is not recognized as an internal or external command: This usually means that the Java Development Kit (JDK) or Java Runtime Environment (JRE) is not installed, or its installation directory is not added to your system's PATH environment variable. You'll need to install Java and configure your PATH correctly.

Multiple Java Versions Installed: If you have multiple Java versions installed, the `java -version` command will show the one that is currently set as the default in your system's PATH. You might need to manage your environment variables or use specific tools (like `sdkman` on Linux/macOS or version managers) to switch between different Java versions.

Conclusion

Regularly checking your JVM version ensures that your Java environment is secure, compatible, and performing optimally. The simple `java -version` command is your key to understanding which version of the Java Runtime Environment you are currently using.

Sources

  1. Java SE Development Kit 17 Downloads - Oraclefair-use
  2. Java Virtual Machine - WikipediaCC-BY-SA-4.0
  3. Java HotSpot Virtual Machine - Oracle Documentationfair-use

Missing an answer?

Suggest a question and we'll generate an answer for it.