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?
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.
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.
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.
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.
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.
Now, we'll add Java binaries as Path variables. To do that, go back to the environment variables 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.
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.