Finding your Java version in three steps

The fastest way to check your Java version is to open a command prompt or terminal window and type a single command. Java stores its version information in a way that any program can read it when ready — you do not need to dig through settings or files.

On Windows, press the Windows key, type cmd, and press Enter. On Mac or Linux, open the Terminal process. Then type this exactly:

java -version

Press Enter. Within a second, you will see text that includes a version number like "17.0.1" or "11.0.13". That number is your Java version. The first number (17 or 11) is what most people mean when they say "which version of Java do I have".

Key Takeaways

  • Open Command Prompt on Windows or Terminal on Mac and Linux, then type java -version to see your installed version when ready.
  • The first number in the output (like 17 or 11) is your major version; the numbers after the dot are minor updates.
  • If you see "java is not recognized" or "command not found", Java is either not installed or not set up in your system path.
  • Some computers have multiple Java versions installed; the one that appears when you type the command is the one your programs will use by default.

Understanding what the version number means

Java version numbers follow a pattern. A version like "17.0.5" breaks down as: 17 is the major release, 0 is the minor release, and 5 is the patch number. Each major version (17, 21, 11) represents a significant update that may include new features or changes to how Java works.

The patch number (the last digit) is a small fix that does not change how the program runs — it just closes security holes or fixes bugs. If you see "17.0.1" and later "17.0.5", both are version 17, but 17.0.5 has five patches applied on top of the base release.

Java releases a new major version every six months, but only certain versions (called Long Term Support or LTS versions) get updates for years. Version 17 and version 21 are LTS versions; version 18 and 19 are not. If your program requires "Java 11 or higher", version 17 will work, but if it requires "Java 17 specifically", version 11 will not.

What to do if the command does not work

If you type java -version and see an error like "java is not recognized as an internal or external command" (Windows) or "command not found" (Mac/Linux), Java is either not installed on your computer or your system does not know where to find it.

First, check whether Java is installed at all. On Windows, open the Control Panel, go to Programs, and look for "Java" in the list. On Mac, open Applications, then Utilities, and look for Java Preferences or check the Applications folder directly. On Linux, type which java to see if the system can locate it anywhere.

If Java is installed but the command still fails, the problem is usually the system path — the list of folders your computer checks when you type a command. This is more common on Windows. You may need to add Java's installation folder to your path, or you may need to reinstall Java and choose the option to set up the path automatically during installation.

Checking Java when you have multiple versions installed

Some computers have more than one version of Java installed — for example, version 11 for one program and version 17 for another. When you type java -version, you see whichever version your system is set to use by default.

To see all installed versions on Windows, search your computer for folders named "jdk" or "jre" (Java Development Kit and Java Runtime Environment). These are usually in C:\Program Files or C:\Program Files (x86). On Mac, type /usr/libexec/java_home -V in Terminal to list every Java version the system knows about. On Linux, type update-alternatives --list java to see all registered versions.

If you need a different version to be the default, you can change which one your system uses. On Windows, this usually means editing your system environment variables. On Mac and Linux, you can use commands like export JAVA_HOME=/path/to/java/version to switch versions temporarily, or edit your shell configuration file to make the change permanent.

Finding the Java installation folder

Sometimes you need to know not just the version, but where Java is actually installed on your computer. This matters if a program cannot find Java or if you need to uninstall a specific version.

On Windows, type where java in Command Prompt. On Mac or Linux, type which java in Terminal. Both commands show you the exact folder path where the active Java version lives. The output might look like C:\Program Files\Java\jdk-17.0.1 on Windows or /usr/libexec/java_home on Mac.

If you need the full installation path rather than just the executable location, you can also look in your system settings. On Windows, Java often appears in the Programs and Features list with its installation path shown. On Mac, Java typically installs in /Library/Java/JavaVirtualMachines/.

Checking Java version in a running program

Sometimes you need to know which Java version a specific program is actually using while it runs, not just which version is set as default. Many Java programs print their Java version to a log file or console window when they start up.

If a program has a Help menu, look for "About" or "System Information" — this often displays the Java version being used. Some programs let you set which Java version to use by editing a configuration file or setting an environment variable before you launch them. If you are running a Java program from the command line, you can add -version before the program name to see which Java it will use, though the exact syntax depends on how the program is set up.

Frequently Asked Questions

Why do I need to know my Java version?

Some programs require a specific Java version to run correctly. If you try to run a program that needs Java 17 but you have Java 11, it will not start. Knowing your version lets you check whether your computer meets the program's requirements before you try to use it.

Is Java the same as JavaScript?

No. Java and JavaScript are completely different languages that happen to have similar names. Java runs on your computer or server; JavaScript runs inside your web browser. Checking your Java version tells you nothing about JavaScript, and you do not need Java installed to use websites.

Can I have Java installed but the command still not work?

Yes. Java can be installed but not added to your system path, which is the list of folders your computer searches when you type a command. This is common on Windows. Reinstalling Java and choosing the option to set up the path automatically usually fixes it.

Do I need to update Java if I have an older version?

It depends on what you use Java for. If a program requires a newer version, you will need to update. If your current version works for everything you do, updating is optional. However, older versions may have security issues, so updating is generally safer if your programs support the newer version.

What if the version number looks different than I expected?

Java changed how it numbers versions in 2018. Older versions used numbers like "1.8" instead of "8", and "1.11" instead of "11". If you see "1.8.0_291", that is Java 8. The "1." prefix is just how older versions were labeled — it does not mean version 1.