Find your Java version in three steps

The fastest way to check your Java version is to open a command window and run a single command. On Windows, press the Windows key and R together, type cmd, and press Enter. On Mac or Linux, open Terminal (search for it in Applications or use Ctrl+Alt+T). Then type this exactly:

java -version

Press Enter. The output will show your Java version number in the first or second line. If you see an error saying "java is not recognized" or "command not found", Java is not installed on your computer, or your system does not know where to find it.

Key Takeaways

  • The command java -version in a command window or terminal shows your installed Java version when ready.
  • Java version numbers follow a pattern like 11.0.15 or 17.0.2, where the first number is the major version.
  • If the command does not work, Java is either not installed or your computer's PATH settings do not point to it.
  • You may have multiple Java versions installed; the one that appears in the command window is the one your system uses by default.
  • Some programs bundle their own Java version, so checking the command line version may not show what a specific program is using.

Understanding Java version numbers

Java version numbers look like 11.0.15 or 17.0.2. The first number (11 or 17) is the major version and is what matters most. Major versions come out every six months, but only certain ones are long-term support releases that stay current for years. Version 8, 11, 17, and 21 are the long-term versions you will most often see on computers.

The numbers after the first dot are the minor version and patch level. A patch like 11.0.15 means version 11, with 15 security and bug fixes applied. You do not usually need to worry about these smaller numbers unless a program specifically requires them.

What to do if the command does not work

If you type java -version and get an error, your system cannot find Java in the expected location. This happens for two reasons: Java is not installed, or it is installed but your computer's PATH — the list of folders where Windows or Mac looks for programs — does not include the Java folder.

First, check whether Java is installed at all. On Windows, open Control Panel, go to Programs, and look for Java in the list. On Mac, open Applications and look for a Java folder. If you do not find it, you will need to read and install Java from Oracle's website or another source before the command will work.

If Java is installed but the command still fails, the PATH is the problem. This is more complex to fix and usually requires editing system settings or reinstalling Java so the installer can set up the PATH correctly. Reinstalling is often faster than manual PATH editing.

When you have multiple Java versions

Many computers have more than one Java version installed. Different programs sometimes need different versions, so they install their own copy. When you run java -version, you see whichever version your system finds first in the PATH.

If a program needs a specific Java version and is not working, it may be using a different version than the one the command shows. Some programs let you tell them which Java to use through settings or environment variables. Others come with their own Java bundled inside and do not use the system version at all. Check the program's documentation to see whether it lets you choose.

Checking Java in Windows Settings

Windows also lets you see installed Java versions through the Control Panel. Open Control Panel, click Programs, then Programs and Features. Scroll through the list and look for entries that say "Java" or "JDK" (Java Development Kit) or "JRE" (Java Runtime Environment). Each one listed is a separate installation on your computer.

This method shows you everything installed but does not tell you which version your system uses by default. For that, the command line method is clearer. However, the Control Panel view is useful if you want to uninstall old versions or see exactly how many copies of Java you have.

Checking Java on Mac

On Mac, the command line method works the same way: open Terminal and type java -version. You can also check through System Preferences in older Mac versions, though newer versions have moved Java settings around. The command line is the most reliable method across all Mac versions.

If you have installed Java from Oracle or another source, it will usually be in /Library/Java/JavaVirtualMachines/. You can see the folder names there to identify which versions are present, though the command line output is clearer for everyday use.

What to do once you know your version

Once you know your Java version, you can decide whether you need to update it. If a program you use requires Java 17 or newer and you have Java 11, you will need to install a newer version. If your version is current and the program works, you usually do not need to change anything.

Java updates come out regularly, especially for security reasons. If you have an older version like Java 8, checking whether your programs still need it is worth doing before updating, because some older software does not work with newer Java versions. Your system may also have automatic updates turned on, which means a newer version could be installed without you noticing.

Frequently Asked Questions

Why does my computer say Java is not installed when I know I use Java programs?

The program you use may have Java bundled inside it rather than using the system Java. Many applications come with their own copy of Java so they do not depend on what you have installed separately. The command line only checks the system version, not the copies hidden inside programs.

Is Java 8 still safe to use?

Java 8 is very old and no longer receives regular security updates from Oracle. If you use it, you are at risk if a security problem is found. Most new programs require Java 11 or newer. If you still have Java 8 and nothing requires it, uninstalling it is safer than keeping it.

Can I have Java 11 and Java 17 on the same computer?

Yes. Multiple versions can coexist without problems. Your system uses one by default (the one the command shows), but programs can be set to use a different version if they need it. Having extras does not hurt, though they do take up disk space.

Do I need to restart my computer after checking my Java version?

No. Checking your version with the command does not change anything on your computer. You only need to restart if you install or uninstall Java.

What is the difference between JDK and JRE?

JRE (Java Runtime Environment) is what you need to run Java programs. JDK (Java Development Kit) is for people who write Java code. Unless you are a programmer, you only need the JRE. Both show up in version checks the same way.