Find your Java version in three ways

The fastest way to check your Java version depends on your operating system. On Windows, Mac, or Linux, you can open a command-line tool and run a single command that tells you exactly which version is installed. If you prefer not to use the command line, you can also check through your system settings or the Java Control Panel. Most people find the command-line method takes about 30 seconds.

Java comes in different editions — Java Runtime Environment (JRE) for running programs, and Java Development Kit (JDK) for writing them — and they can have different versions installed at the same time. Knowing which one you have matters if a program requires a specific version to work.

Key Takeaways

  • Open Command Prompt (Windows), Terminal (Mac or Linux), and type java -version to see your installed Java version in seconds.
  • The output shows the version number, build number, and whether you have JRE or JDK installed.
  • If the command returns "java is not recognized" or "command not found", Java is not installed or not in your system path.
  • You can also check Java version through the Java Control Panel on Windows, found in your system settings under Programs.

Check Java version on Windows using Command Prompt

Open Command Prompt by pressing the Windows key, typing cmd, and pressing Enter. A black window will open. Type the following exactly as shown and press Enter:

java -version

The output will show something like "java version 17.0.1" or "openjdk version 11.0.13". The first number (17, 11, etc.) is your major version. If you see a message saying "java is not recognized as an internal or external command", Java is either not installed or your system cannot find it in the standard location.

Check Java version on Mac using Terminal

Open Terminal by pressing Command + Space, typing terminal, and pressing Enter. Type the same command:

java -version

Press Enter. You will see output similar to the Windows version. On Mac, if you have multiple Java versions installed, this command shows the one your system uses by default. If you get "command not found", Java is not installed or not in your path.

Check Java version on Linux using Terminal

Open your terminal application (the method varies by Linux distribution). Type:

java -version

Press Enter. The output format is the same as Windows and Mac. Linux users often have Java installed through a package manager, so if it is not found, you may need to install it through your distribution's software center or package manager (apt, yum, pacman, etc.).

Understand the version number format

Java version numbers follow a pattern. A version like "17.0.5" breaks down as: 17 is the major release number, 0 is the minor version, and 5 is the patch number. Newer versions (Java 9 and later) use this format. Older versions use a different format like "1.8.0_301", where 1.8 is the major version (Java 8) and 301 is the update number.

The output also shows the vendor — Oracle, OpenJDK, Amazon Corretto, Eclipse Temurin, or others. Different vendors release their own builds of Java, but the version number tells you which release you have. If a program requires "Java 11 or later", any version 11 or higher works, regardless of vendor.

Check Java version through the Java Control Panel (Windows)

If you prefer not to use Command Prompt, you can check through your system settings. Go to Settings, then Programs, then Programs and Features. Look for entries that say "Java" or "Java Runtime Environment". The version number appears in the list next to the program name.

Alternatively, search for "Java Control Panel" in your Windows search bar. If it opens, click the About button. A window will show your Java version. This method works only if Java is installed through the standard Oracle installer; other distributions may not have a Control Panel.

What to do if Java is not installed

If the command returns an error, Java is not installed on your system. Some programs bundle Java with themselves, so you may still be able to run Java programs without a separate installation. Check the program's documentation to see if it includes its own Java runtime.

If you need to install Java, download it from the official Java website or use your system's package manager (apt on Ubuntu, brew on Mac, etc.). Different programs may require different versions, so check what version your program needs before installing.

Frequently Asked Questions

Why does my computer say Java is not installed when I know I have it?

Java may be installed but not in your system path, which is the list of locations your computer checks for programs. This happens when Java is installed in a non-standard location or when your system environment variables were not set up correctly. Reinstalling Java usually fixes this, or you can manually add Java to your path through your system settings.

Can I have more than one version of Java installed?

Yes. The java -version command shows the default version your system uses, but other versions can exist elsewhere on your computer. Some programs install their own Java version in their own folder. If you need to know about all installed versions, search your hard drive for folders named "java" or "jdk".

What is the difference between Java 8 and Java 17?

Java 17 is much newer and includes security updates, performance improvements, and new features that Java 8 does not have. Java 8 is older but still widely used. Most programs work with either, but some newer software requires Java 11 or later. Check your program's documentation to see which version it needs.

Do I need JDK or JRE?

If you only run Java programs, you need JRE (Java Runtime Environment). If you write or compile Java code, you need JDK (Java Development Kit), which includes JRE plus development tools. The java -version command output tells you which one you have.