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. 🤞
- Check If Java is Already Installed
- How to Download Java?
- How to Install Java?
- How to Configure Environment Variables for Java?
1. Check If Java is Already Installed
Open Start Menu and type
CMD. Then click on it on the search results.
java -versioncommand and hit
Enter. If you see
java is not recognized as an internal or external command, operable program or batch fileresponse 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.
javac --versioncommand 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.
2. How to Download Java?
Go to Oracle Download page: https://www.oracle.com/java/technologies/javase-downloads.html
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 Downloadlink to start the download.
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.
Check the checkbox that I've shown below to accept the license agreement. Then click the download button.
3. How to Install Java?
Double-click on the downloaded file to start the installation.
Since the installation needs administrator privileges, Windows 11 want to confirm to run it. Click
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
Java is installed correctly. 👏 Now, follow the next step to configure environment variables for Java.
4. How to Configure Environment Variables for Java?
Open File Explorer and paste the location where Java was installed, and you've noted before. Then hit
Enterto go there. You also can go there by following
C:\Program Files\Java\jdk-version-you-installed\path if you want.
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.
Variable namefield, and type the path where Java is located in the
Variable valuefield. Then click
Now, we'll verify whether
JAVA_HOMEis available. To do that, open Command Prompt again by searching for
cmdon Start Menu. Don't use the old window, please, because changes on environment variables require restarting Command Prompt.
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.
Now, we'll add Java binaries as Path variables. To do that, go back to the environment variables window.
System variablessection by scrolling down. Click on it to select. Then click
Now, you may see
C:\Program Files\Common Files\Oracle\Java\javapathvariable has already been set. If so, you don't need to change anything in this window. Click
OKand close the window.
Otherwise, you need to add it manually. Click
Newon the right side of the window. An empty text field will be created at the bottom of the list. Type
%JAVA_HOME%/binthere and hit
Enter. Then click
Close the windows related to environment variables.
Command Promptagain and type
javac -versioncommands, respectively.
You'll see the version numbers of both, like the image below.
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. 🤞
Is it free to download or install Java on Windows 11?
Yes, it is free.
Is it official the installation file that we've downloaded?
Yes, it is official, of course. We've downloaded it from Oracle's website.
Is Java safe to install?
Yes, it is safe.
Which Java version is best for Windows 11?
Java SE 16.01 or later
How do I know if Java is installed on Windows 11?
Open Command Prompt, then type
javac -versioncommands, respectively.
Where is Java located on Windows 11?
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)
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.
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.
I have this issue as well. any advice?
Great work man. Thanks so much
I complete all procedures as indicated above, but I fail to the program(java program).
please help me
please, help me to create shortcut on the desktop
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