Java is one of the most-used programming languages to date. For that reason, many applications written in Java require the Java Runtime Environment (JRE) to be installed on your Windows 11 computer to be able to run.
This article illustrates how you can install Java on a Windows 11 computer, and how to remove it if and when required. Moreover, it also illustrates how to create the environmental variable for Java in Windows 11.
Table of Contents
How to check the Java version on Windows 11
Before we tell you how to install Java, we must first check whether Java is already installed on your computer or not. If so, what is its version?
Follow the steps below to check the installation or version of Java:
- Launch the Command Prompt with administrative privileges.
- Type in java -version to check whether java is installed on your computer or not.
If the command returns “java is not recognized as an internal or external command, operable program or batch file,” it means that Java is not installed on your system.
However, if it is installed, you will see its version written in the Command Prompt, as in the image below:
Install Java on Windows 11
Installing Java on your computer is not that difficult. We have discussed how you can install it on your Windows 11 device. However, the process is pretty much the same across all Windows versions.
Java can also be installed on Linux and MacOS platforms, but the packages/files to install it will be different for each platform.
Follow the steps below to install the latest version of Java on Windows 11:
- Open the Java downloads page for Windows and click on the download link for x64 Installer.
- A JDK file will now begin to download (which includes JRE). Once it does, click on it to execute. If prompted with a User Access Control (UAC), click Yes.
- The Java installation wizard will now run. Click Next on the first screen.
- On the next screen, click Next again. The installation will now begin at the default path set by the wizard.
- Java installation will be completed within a minute or two. Once it is done, click Close.
Java should now be successfully installed on your Windows 11 device. You can confirm this by running the java -version command in Command Prompt again, as discussed in the previous section of this post.
Create Environmental Variable for Java on Windows 11
Environmental paths in Windows allow a user for any file to be recognized anywhere within the system. This means you can then execute a .exe file (or any other file) from anywhere within the directory, rather than having to navigate to a directory and only then be able to use it.
Before we begin, you must first know the complete path to where Java’s latest version has been installed as it will be needed later when configuring the environmental variable. The installation path by default is C:\Program Files\Java\JavaVersion (where JavaVersion is a folder named with the Java version). Since we have installed JDK 17.0.1, the complete path for Java on our device is C:\Program Files\Java\jdk-17.0.1:
Now that you know the complete path, follow the guide below to create a Java environmental path:
- Open the System Properties window on your computer by typing in sysdm.cpl in Run.
- In the System Properties window, switch to the Advanced tab and then click the Environment Variables button at the bottom.
- Now click on New under the System variables window.
- In the New System Variable window, enter the following corresponding details:
Variable Name: JAVA_HOME
Variable Value: C:\Program Files\Java\jdk-17.0.1
Variable Name is the path to the installation folder determined earlier. Click OK when done.
- Click OK again on the Environmental Variables as well as the System Properties window to close them.
You have now successfully created the Java environmental variable on your Windows 11 device. You can further manipulate this variable by changing the Variable Value to run an older version of Java (if already installed).
Furthermore, you can also delete the variable by selecting it from under the System Variables list in the Environmental Variables window and then clicking Delete.
How to Uninstall Java on Windows 11
You can also remove Java from your Windows 11 device just as easily, if and when you no longer need it. Here’s how:
- Open the Programs and Features page in the Control Panel by typing in appwiz.cpl in Run.
- Now double-click the Java Development Kit that you want to remove from your device. If prompted for a confirmation, click Yes.
Java will now remove itself from your computer with no restart required.
Can Java be installed on Windows 11?
Yes, Java is fully compatible with Windows 11.
Where is Java installed?
The default location for the Java installation is C:\Program Files\Java
Is it safe to uninstall Java?
Yes, removing Java from your device will have no negative effect. However, it is not recommended as most apps and programs need Java to run.
How to install Java without signing in to Oracle?
You can head directly to the Oracle download page on the following link and download Java without having to sign in:
What is the difference between JDK and JRE?
JRE is a piece of software that is installed on your computer that allows you to run applications developed in Java on your device, whereas JDK is a development kit used by developers. JDK includes both JRE and JVM.