Do you need to check if the latest version of Java is installed on your Windows PC? An easy way to see if Java is up to date is to type a quick command at the Windows command prompt. No matter which version of Windows you're using, you can type "java -version" into the command prompt (cmd) to see the version number of your Java installation. This wikiHow article will teach you how to use the command prompt to find out which version of Java (or the Java compiler) is installed on Windows 10, 11, and earlier versions.

Things You Should Know

  • The java -v command displays the installed version of Java, while javac -v displays the version of the Java compiler.
  • If you see the error "Java is not recognized as an internal or external command," Java is either not installed, or its path is not in the system environment variables.
  • You can always download the latest version of JDK and JRE from https://www.oracle.com/java/technologies/downloads.
Method 1
Method 1 of 3:

Windows 10 & 11

  1. 1
    Click the Windows Start menu. It's the icon with Windows logo. By default, it's in the bottom-left corner of the taskbar.
    • You can also press the Windows key to open the Start menu.
  2. 2
    Type cmd. This displays the Command Prompt icon at the top of the search results.
    Advertisement
  3. 3
  4. 4
    Type java -version and press Enter. Once you run this command, you'll see the Java version next to "java version" on the first line.
    • To check the version of the Java compiler, use javac -version.
    • If you see an error that says "'java is not recognized as an internal or external command, operable program or batch file," Java is either not installed or not properly added to your path. Add Java to your system path to fix the error.
  5. Advertisement
Method 2
Method 2 of 3:

Using Windows 8, 7, and XP

  1. 1
  2. 2
    Click Run. It's the third option from the bottom of the System menu. This opens the "Run" program.
  3. 3
    Type cmd.exe and click OK. Use the space next to "Open" in the Run program to type the command to open the Command Prompt.
  4. 4
    Type java -version and press Enter. You'll see the currently installed version of Java next to "java version."
    • To check the version of the Java compiler, use javac -version.
    • If you see an error that says "'java is not recognized as an internal or external command, operable program or batch file," Java is either not installed or not properly added to your path. Add Java to your system path to fix the error.
  5. Advertisement
Method 3
Method 3 of 3:

Fix the "Java is Not Recognized" Error

  1. 1
    Find out where Java is installed. If you've installed Java but you're unable to check the version from the command line, you might just need to add the Java path to your system environment variables. But first, you'll need to figure out where Java is installed:
    • First, press Windows key + S and type java. If there are no results on your computer, you will need to install Java, which you can download from https://www.oracle.com/java/technologies/downloads.
    • If Java is installed, right-click the Start menu and select File Explorer.
    • Locate the Java installation directory, which will look something like this (depending on your version): C:\Program Files\Java. If you don't see a Java installation directory in C:\Program Files, look in C:\Program Files(x86)\Java or C:\Java.
    • Open the folder number containing the most recent version number for JRE or the JDK, e.g. C:\Program Files\Java\jdk17.0.4.1 or C:\Program Files\Java\ jdk1.8.X_XXX.
    • Highlight the full path to the current folder at the top of File explorer and press Ctrl + C to copy.
  2. 2
    Open your Advanced System Settings.
    • On Windows 11, 10, and 8, press Windows key + S, type View advanced system settings, then click Advanced System Settings.
    • On Windows 7, right-click My Computer, click Properties, then click Advanced.
  3. 3
    Click the Environment Variables… button. You'll see this near the bottom-right corner of the window.
  4. 4
    Click New… under "System variables." This is the bottom section. Adding a new item to System variables instead of User variables ensures that the Java path will be correct for all users on this PC, not just your own user account.
  5. 5
    Type JAVA_HOME (for JDK) or JRE_HOME (for JRE). Create this variable name based on whether you installed the Java Development Kit or the Java Runtime Environment.
  6. 6
    Paste the copied path to Java into the "Variable value" field. You can do this by right-clicking the bottom field and selecting Paste.[1]
  7. 7
    Click OK to save your variable. Now that you've added Java to your path, you can successfully check your Java version from the command prompt. Just close the open command prompt window, open a new one, then run java -v to find your version.
  8. Advertisement

Expert Q&A
Did you know you can get expert answers for this article? Unlock expert answers by supporting wikiHow

  • Question
    How do I check my version of Java with the command prompt?
    Yaffet Meshesha
    Yaffet Meshesha
    Computer Specialist
    Yaffet Meshesha is a Computer Specialist and the Founder of Techy, a full-service computer pickup, repair, and delivery service. With over eight years of experience, Yaffet specializes in computer repairs and technical support. Techy has been featured on TechCrunch and Time.
    Yaffet Meshesha
    Computer Specialist
    Expert Answer

    Support wikiHow by unlocking this expert answer.

    Open Command Prompt, type java -version, then press Enter. This will print out the current version of Java that you're running, as well as the build number.
  • Question
    How do I set java path?
    Hrithik Nitish
    Hrithik Nitish
    Community Answer
    To check version from Windows command prompt, at first you have to download Java and then save the Java bin file address to Windows environment variable and than you have to open Command Prompt and enter Java where you have installed the Java version.
Advertisement

About This Article

Yaffet Meshesha
Co-authored by:
Computer Specialist
This article was co-authored by Yaffet Meshesha and by wikiHow staff writer, Nicole Levine, MFA. Yaffet Meshesha is a Computer Specialist and the Founder of Techy, a full-service computer pickup, repair, and delivery service. With over eight years of experience, Yaffet specializes in computer repairs and technical support. Techy has been featured on TechCrunch and Time. This article has been viewed 455,189 times.
How helpful is this?
Co-authors: 17
Updated: November 23, 2022
Views: 455,189
Categories: Java
Article SummaryX

1. Click the Windows Start icon.
2. Type cmd to display the Command Prompt icon in the Start menu.
3. Click on the Command Prompt icon.
4. Type java -version in the Command Prompt.
5. Press Enter.

Did this summary help you?
Advertisement