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, the vendor (usually Oracle), and your system architecture. This is the standard method on Windows, and it works whether you have Java Development Kit (JDK) or Java Runtime Environment (JRE) installed.

If you see an error message saying "java is not recognized as an internal or external command", Java is either not installed on your system or not added to your system PATH. The PATH is a list of folders Windows searches when you type a command — if Java's folder isn't in that list, Command Prompt can't find it.

Key Takeaways

  • Type java -version in Command Prompt to see your Java version, vendor, and system type in seconds.
  • A "not recognized" error means Java isn't installed or your system PATH doesn't include Java's installation folder.
  • Use javac -version to check if you have the Java compiler installed (part of JDK, not JRE).
  • You can find your full Java installation path by typing where java in Command Prompt.

Opening Command Prompt on Windows

Press the Windows key and type cmd, then press Enter. This opens Command Prompt with a black window and a blinking cursor. You can also right-click on your desktop, select "New," and look for a shortcut option, though this varies by Windows version.

Once Command Prompt is open, you're ready to type commands. The window shows your current folder path on the left side of each line — you don't need to navigate anywhere specific to check Java version.

Understanding the version output

When you run java -version, the output typically looks like this: java version "17.0.1" 2021-10-19 LTS. The first number (17 in this example) is the major version. The second number (0) is the minor version. The third number (1) is the patch version. LTS means Long Term Support — Oracle maintains these versions longer than standard releases.

The second line usually shows the vendor, such as "Oracle Corporation" or "OpenJDK". The third line displays your system architecture: 64-Bit or 32-Bit. If you're running 64-bit Windows, you should ideally have 64-bit Java installed for better performance, though 32-bit Java will still work.

Checking for the Java compiler

If you need to write and compile Java code, you need the JDK, not just the JRE. The JRE only runs Java programs. To check if you have the compiler installed, type javac -version in Command Prompt and press Enter.

If javac is installed, you'll see output similar to javac 17.0.1. If you see "javac is not recognized", you have the JRE but not the JDK. You would need to download and install the JDK from Oracle or use an open-source alternative like OpenJDK.

Finding your Java installation folder

To see the exact location where Java is installed on your computer, type where java in Command Prompt. This shows the full file path to the java.exe file. On most Windows systems, it looks something like C:\Program Files\Java\jdk-17.0.1\bin\java.exe.

Knowing this path is useful if you need to manually add Java to your system PATH, troubleshoot installation problems, or verify which version is being used when multiple Java versions are installed. If where java returns nothing, Java is not in your PATH, even if it's installed somewhere on your computer.

Fixing "java is not recognized" errors

If Command Prompt doesn't recognize the java command, your system PATH needs to be updated. First, find where Java is installed by searching your computer for a folder named "jdk" or "java" — typically in C:\Program Files\Java. Inside that folder, look for a bin subfolder.

Then add that bin folder to your system PATH. Right-click "This PC" or "My Computer" on your desktop, select "Properties," click "Advanced system settings," then click "Environment Variables." Under "System variables," find the variable named "Path," click "Edit," and add the full path to your Java bin folder (for example, C:\Program Files\Java\jdk-17.0.1\bin). Click OK on each dialog, close Command Prompt completely, reopen it, and try java -version again.

Multiple Java versions on one computer

Some computers have more than one Java version installed. When you type java -version, Command Prompt runs whichever version appears first in your system PATH. If you need to use a different version, you can type the full path to that version's java.exe file instead — for example, C:\Program Files\Java\jdk-11.0.12\bin\java -version.

To see all Java installations on your computer, open File Explorer and navigate to C:\Program Files\Java. Each folder represents a separate installation. If you have versions you no longer use, you can uninstall them through Windows Settings under "Apps" or "Programs and Features" to free up disk space.

Frequently Asked Questions

Why does my Command Prompt say "java is not recognized"?

Java is either not installed, or the folder containing java.exe is not in your system PATH. Install Java from Oracle or OpenJDK, or add the Java bin folder to your PATH through Environment Variables in Windows Settings. After editing PATH, close and reopen Command Prompt for the change to take effect.

What's the difference between java -version and javac -version?

java is the runtime — it runs compiled Java programs. javac is the compiler — it converts source code into runnable programs. If you only see java but not javac, you have the JRE installed. To write and compile code, download the JDK instead.

Can I have two different Java versions running at the same time?

You can install multiple Java versions on one computer, but Command Prompt will use whichever one appears first in your PATH. Individual programs can be configured to use a specific Java version by pointing to that version's full file path, but you can't run two versions simultaneously in the same Command Prompt window.

Does checking Java version work the same way on Mac or Linux?

Yes — type java -version in Terminal (Mac) or your terminal emulator (Linux) and you'll see the same output. The command and behavior are identical across Windows, Mac, and Linux because Java is designed to work the same way on all operating systems.