The quickest way to check your Java version

Open Command Prompt and type java -version, then press Enter. The output will show your installed Java version number in the first line. If you see an error message instead, Java is either not installed or not set up in your system path — the folder where Windows looks for programs.

You can also use javac -version to check the Java compiler version, which is useful if you're writing and compiling Java code. The compiler version usually matches the runtime version, but not always if you've installed multiple Java versions.

Key Takeaways

  • Type java -version in Command Prompt to see your installed Java runtime version immediately.
  • An error message means Java is not in your system path, even if it's installed on your computer.
  • Use javac -version to check the compiler version separately if you're developing Java programs.
  • The version number format is usually major.minor.patch, like 17.0.1 or 11.0.13.

Understanding the version output format

When you run java -version, you'll see output that looks something like this:

java version "17.0.1" 2021-10-19 LTSJava(TM) SE Runtime Environment (build 17.0.1+12-39)Java HotSpot(TM) 64-Bit Server VM (build 17.0.1+12-39, mixed mode, sharing)

The first number — 17 in this example — is the major version. The second number after the dot is the minor version. These two together tell you which Java release you have. Java 8, Java 11, Java 17, and Java 21 are the long-term support versions that most workplaces use, so knowing whether you have one of these matters for compatibility.

The "LTS" label means Long-Term Support, which means Oracle will patch security issues for many years. Non-LTS versions get updates for only six months, so they're less common in production environments.

What to do if you get an error message

If Command Prompt says "java is not recognized as an internal or external command", Java is installed but Windows doesn't know where to find it. This happens because Java's installation folder isn't in your system path.

First, find where Java is actually installed. Open File Explorer and navigate to C:\Program Files or C:\Program Files (x86) and look for a folder named something like "Java" or "jdk-17" or "jre". Note the full path — for example, C:\Program Files\Java\jdk-17.0.1.

Then add that path to your system environment variables. Right-click "This PC" or "My Computer" on your desktop, select Properties, click "Advanced system settings", then "Environment Variables". Under System variables, find the one called "Path", click Edit, and add a new entry with your Java bin folder path — for example, C:\Program Files\Java\jdk-17.0.1\bin. Click OK on all the dialogs, close Command Prompt completely, and open a new one. Now java -version should work.

Checking for multiple Java versions

Some computers have more than one Java version installed. When you type java -version, you see whichever one is listed first in your system path. To see all installed versions, you can search your Program Files folder manually or use a command to find the Java executable.

In Command Prompt, type where java to see the path to the Java version currently in your path. If you have multiple versions installed, this shows you which one is active. You can then check each installation separately by running the full path directly — for example, C:\Program Files\Java\jdk-11.0.13\bin\java -version to check Java 11 specifically.

If you need a different version to be the default, you can either change your system path to point to that version first, or always use the full path when you need a specific version.

The difference between JDK and JRE versions

Java comes in two main packages: the JDK (Java Development Kit) and the JRE (Java Runtime Environment). The JDK includes everything you need to write and compile Java code, plus the runtime to run it. The JRE is just the runtime — it runs Java programs but can't compile them.

If you're a developer, you need the JDK. If you just need to run Java programs someone else wrote, the JRE is enough. When you check java -version, it tells you which one you have. The output will say "Java(TM) SE Runtime Environment" for either package, but the JDK installation includes the compiler (javac) while the JRE does not.

You can have both installed at the same time. Your system path determines which one runs by default when you type java in Command Prompt.

Checking the Java compiler version separately

If you write Java code, you also need the compiler. Type javac -version in Command Prompt to see the compiler version. This should match your runtime version, but if you've installed multiple versions or updated one without the other, they might differ.

If javac -version gives an error but java -version works, you have the JRE installed but not the JDK. You'll need to download and install the JDK to compile Java code. If both commands work but show different versions, you may need to update your path or reinstall one of them to match.

Frequently Asked Questions

Why does java -version show a different version than what I installed?

You likely have multiple Java versions installed, and your system path points to a different one than you expected. Use where java to see which installation is active, then either change your path or use the full path to the version you want.

Can I have Java 8 and Java 17 installed at the same time?

Yes. You can install multiple versions side by side. Your system path determines which one runs by default, but you can always run a specific version by using its full path in Command Prompt.

What does "64-Bit Server VM" mean in the version output?

It means you have the 64-bit version of Java installed, which can use more memory and is standard on modern computers. A 32-bit version would say "32-Bit Client VM" instead. Most new Java installations are 64-bit.

Do I need to update Java if I see an old version number?

It depends on what you're using Java for. If you're running programs that need a specific version, check their documentation. If you're developing new code, using a recent LTS version like Java 17 or 21 is usually a good idea for security and performance.

How do I uninstall a Java version I don't need?

Go to Control Panel, select Programs, then Programs and Features. Find the Java version you want to remove in the list, click it, and select Uninstall. After removing it, you may need to update your system path if it was the default version.