The fastest way to check your Java version

Open your command line or terminal and type java -version, then press Enter. The output will show your installed Java version in the first line. On Windows, search for "Command Prompt" in the Start menu. On Mac or Linux, open Terminal from your Applications folder or use Spotlight search.

If you get an error saying "java is not recognized" or "command not found", Java is either not installed on your computer or not set up in your system's PATH — the list of locations your computer checks when you type a command. This is common and fixable.

The version number appears in a format like "17.0.1" or "11.0.13". The first number (17 or 11) is the major version. The numbers after the dot are the minor version and patch level. Most programs care about the major version — whether you have Java 8, 11, 17, or 21.

Key Takeaways

  • Type java -version in Command Prompt (Windows) or Terminal (Mac/Linux) to see your installed version immediately.
  • If the command does not work, Java is not installed or your system cannot find it in the PATH.
  • You can also check the version through your system settings or Java Control Panel if you have the full Java Development Kit installed.
  • Different programs may need different Java versions, so knowing your version helps you decide whether to update or install a second copy.

What to do if the command does not work

If typing java -version returns an error, your system does not know where Java is located. This happens when Java is installed but not added to your PATH, or when Java is not installed at all.

On Windows, try searching for "Java" in the Start menu. If Java Control Panel appears, Java is installed but not in your PATH. You can add it by finding the Java installation folder (usually C:\Program Files\Java) and adding it to your system PATH through Settings. On Mac, Java may be installed in /Library/Java/JavaVirtualMachines/. On Linux, use which java to see if Java exists anywhere on your system.

The simplest fix is often to reinstall Java from the official Oracle website or use a package manager. On Mac, you can use Homebrew by typing brew install openjdk. On Linux, most distributions have Java in their package manager — Ubuntu users can type sudo apt install default-jdk.

Checking Java through the Control Panel

If you installed the full Java Development Kit (JDK) rather than just the Java Runtime Environment (JRE), you may have a Java Control Panel. On Windows, go to Settings, search for "Java", and click "Java (64-bit)" or "Java (32-bit)" depending on your system. The General tab shows your installed version.

On Mac, open System Preferences, scroll down to find Java, and click it. The version appears in the first window. This method works only if you installed Oracle's official Java package with the Control Panel included.

The Control Panel also shows whether you have 32-bit or 64-bit Java. Most modern computers and programs use 64-bit, but some older software still needs 32-bit. If a program says it cannot find Java, you may need the other architecture.

Understanding Java versions and what they mean

Java version numbers changed their naming system in 2018. Versions 8 and earlier used names like "Java 8" or "Java 7". Starting with version 9, Oracle switched to year-based numbering: Java 11 (2018), Java 17 (2021), Java 21 (2023). Long-term support versions — the ones most programs use — come out every three years.

The version you see in java -version output may look like "11.0.15" or "17.0.5". The first number is what matters for compatibility. A program built for Java 11 usually runs on Java 17, but not always on Java 8. Older software sometimes requires Java 8 specifically.

You can have multiple Java versions installed on the same computer. This is useful if one program needs Java 8 and another needs Java 17. Your system uses whichever one is in the PATH by default, but you can point individual programs to different versions.

Checking Java on different operating systems

Windows: Open Command Prompt (search "cmd" in the Start menu) and type java -version. If that does not work, try where java to see if Java exists anywhere on your system. You can also check C:\Program Files\Java in File Explorer to see what versions are installed.

Mac: Open Terminal (search "Terminal" in Spotlight) and type java -version. If you have multiple Java versions, type /usr/libexec/java_home -V to see all of them. This command shows the full path to each installation, which is useful if you need to switch between versions.

Linux: Open a terminal and type java -version. If you have multiple versions, type update-alternatives --list java (on Debian-based systems like Ubuntu) or alternatives --list java (on Red Hat-based systems) to see all installed versions. You can then switch the default with update-alternatives --config java.

Why you might need to know your Java version

Many programs and tools run on Java, and they often specify which version they need. A network tool, development environment, or server application might say "requires Java 11 or higher" or "compatible with Java 8 only". Knowing your version tells you whether you can run that software without installing something new.

If you are setting up a networked application or server, the Java version affects performance and security. Newer versions are faster and have security patches, but older software sometimes breaks on new versions. Checking your current version is the first step in deciding whether to update.

Developers and system administrators check Java version regularly when troubleshooting. If a program crashes or behaves strangely, the wrong Java version is often the cause. Knowing what you have installed makes it easier to spot the problem.

Frequently Asked Questions

Can I have more than one Java version on my computer?

Yes. You can install multiple Java versions side by side. Your system uses whichever one is in the PATH by default, but individual programs can be pointed to a different version. This is useful when one program needs Java 8 and another needs Java 17.

What is the difference between JDK and JRE?

JRE (Java Runtime Environment) runs Java programs. JDK (Java Development Kit) includes the JRE plus tools for writing and compiling Java code. Most users need only the JRE. Developers need the JDK. Both show the same version number when you type java -version.

Is 32-bit or 64-bit Java better?

64-bit is better for modern computers and handles larger programs. Most software now requires 64-bit. Use 32-bit only if a specific program demands it. You can check which you have by looking at the full output of java -version — it says "64-Bit Server VM" or "32-Bit Client VM".

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

It depends on what you use Java for. Newer versions are faster and more secure. If you run programs that specify a newer version, you must update. If your current programs work fine, updating is optional but recommended for security reasons.

Why does my Java version show a different number in different places?

You may have multiple Java versions installed. The command line shows whichever version is in your PATH. The Control Panel or file system might show a different one. Type where java (Windows) or /usr/libexec/java_home -V (Mac) to see all installed versions and their locations.