Windows 11 Community

Windows 11 Community is a community of amazing Windows users

We're a place where Windows 11 and 10 users can ask for help and share their knowledge.

Create account Log in
Cover image for How to Install Java on Windows 11?
Muhammed Cetin
Muhammed Cetin

Posted on • Updated on

How to Install Java on Windows 11?

In this tutorial, I'm going to show you how to install Java and configure its environment variables on Windows 11, including JAVA_HOME.

Even if you don't have any idea about how to complete these tasks, thanks to the clear explanations and screenshots for each step, you'll be able to install Java completely.

Let's start. 🤞


  1. Check If Java is Already Installed
  2. How to Download Java?
  3. How to Install Java?
  4. How to Configure Environment Variables for Java?

1. Check If Java is Already Installed

  1. Open Start Menu and type CMD. Then click on it on the search results.

  2. Type java -version command and hit Enter. If you see java is not recognized as an internal or external command, operable program or batch file response like on the image below, it means Java isn't installed on your Windows 11. However, if you see java version 16.0.1... response, it means you already have Java. In this case, run the command in 3rd step to check whether javac is already installed.
    java -version

  3. Type javac --version command on Command Prompt and hit Enter. If you see a response like javac 16.0.1, you already have Java on your PC, and you don't need to install it again. Otherwise, continue to follow the installation steps.
    javac -version

2. How to Download Java?

  1. Go to Oracle Download page:

  2. On this page, there are some downloadable Java versions. We'll download the latest version where is at the top of the page. When I'm writing this guide, the latest version of Java is SE 16. Click JDK Download link to start the download.
    JDK Download

  3. On this page, there are different installation files of Java for different operating systems. Scroll down to show the download links. Since we'll install it on Windows 11, we need to download .exe file that I've marked. Click on it.
    Download JDK Installer .exe

  4. You'll see a disabled download button on the pop-up.
    Accept Oracle License Agreement

  5. Check the checkbox that I've shown below to accept the license agreement. Then click the download button.
    Download JDK

  6. Click Save file.
    Save Java Installer

3. How to Install Java?

  1. Double-click on the downloaded file to start the installation.
    Double-click on the installer

  2. Since the installation needs administrator privileges, Windows 11 want to confirm to run it. Click Yes.

  3. Click Next.

  4. Note the destination folder because we need it when configuring environment variables. Since we've downloaded the 64-Bit installation file, Java will be installed on C:\Program Files\Java\jdk-version-number\ location. Ensure you've noted this location. Then click Next.
    Specify the location

  5. The installation will start.

  6. Click Close.

  7. Java is installed correctly. 👏 Now, follow the next step to configure environment variables for Java.

4. How to Configure Environment Variables for Java?

  1. Open File Explorer and paste the location where Java was installed, and you've noted before. Then hit Enter to go there. You also can go there by following C:\Program Files\Java\jdk-version-you-installed\ path if you want.
    Java Path

  2. We'll define this path as our JAVA_HOME environment variable now. Open Start Menu and type environment variables. Then click on it on the search results.
    Open Environment variables settings

  3. Click Environment Variables.
    Open Environment variables

  4. Click New under System variables section.
    Add a new System variable

  5. Type JAVA_HOME in Variable name field, and type the path where Java is located in the Variable value field. Then click OK.

  6. Now, we'll verify whether JAVA_HOME is available. To do that, open Command Prompt again by searching for cmd on Start Menu. Don't use the old window, please, because changes on environment variables require restarting Command Prompt.

  7. Type echo %JAVA_HOME%, and press Enter. If you see a result like the one below, everything is OK. Otherwise, delete the variable and try to set it again.
    Verify JAVA_HOME

  8. Now, we'll add Java binaries as Path variables. To do that, go back to the environment variables window.

  9. Find Path variable under System variables section by scrolling down. Click on it to select. Then click Edit.
    Path variable

  10. Now, you may see C:\Program Files\Common Files\Oracle\Java\javapath variable has already been set. If so, you don't need to change anything in this window. Click OK and close the window.
    If JAVA binary path is already defined

  11. Otherwise, you need to add it manually. Click New on the right side of the window. An empty text field will be created at the bottom of the list. Type %JAVA_HOME%/bin there and hit Enter. Then click OK.
    Define Java Path with JAVA_HOME

  12. Close the windows related to environment variables.

  13. Open Command Prompt again and type java -version and javac -version commands, respectively.

  14. You'll see the version numbers of both, like the image below.
    Verify java and javac

  15. That's all. 😊


If you've followed all steps carefully, you can run Java programs or games on Windows 11. However, if you're in trouble with Java installation or usage, feel free to ask for help by using the discussion form below. I'll try to answer your questions within the same day. 🤞


  1. Is it free to download or install Java on Windows 11?

    Yes, it is free.

  2. Is it official the installation file that we've downloaded?

    Yes, it is official, of course. We've downloaded it from Oracle's website.

  3. Is Java safe to install?

    Yes, it is safe.

  4. Which Java version is best for Windows 11?

    Java SE 16.01 or later

  5. How do I know if Java is installed on Windows 11?

    Open Command Prompt, then type java -version and javac -version commands, respectively.

  6. Where is Java located on Windows 11?

    C:\Program Files\Java

  7. Should I remove Java from Windows 11?

    If you have enough free disk space, you shouldn't remove it. Java is one of the most common programming languages, and you might need to run a Java program in your Windows 11 later.


Top comments (8)

benshamman2525 profile image

I feel this is outdated because I watched another guide. I opened everything you showed in this guide but I've had issues after the video guide also (everything in the video worked, ended off with "just open files with java now"). I would hope you could update this and hope it could work for me? I've been trying to install java for 3 and a half days now.

avmcc profile image
abby • Edited on

every time I type ‘javac-version’ it says javac is not recognized, everything else showed up like it should. When trying to run programs through java it says ‘unable to install Java’ although it’s been installed it.

harmful_creator_e040eddce profile image
harmful creator

I have this issue as well. any advice?

tobiq_net_b68299d7737a984 profile image
Tobiq Net

Great work man. Thanks so much

qualityz profile image

I complete all procedures as indicated above, but I fail to the program(java program).
please help me

qualityz profile image

please, help me to create shortcut on the desktop

harmful_creator_e040eddce profile image
harmful creator

@Muhammed Cetin

hrushikesh_hardik_284067b profile image
Hrushikesh Hardik

Followed the steps perfectly, but im only getting the correct response for java -version but for javac -version it is saying javac is not recognized as a command