How to Setup Environment Variables for JAVA in Windows 11?

How to Setup Environment Variables for JAVA in Windows 11?

28 June 2023 0 By Anshul Pal

If you have installed Java on Windows 11 and are facing an error like this, “The term ‘Java’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.” So, don’t worry, this tutorial helps you to setup environmental variables in Windows 11. The environment variable is a variable that is used by the system to locate the installation path and other system preferences.

There are two types of Environmental Variables :-

  • System-Specific Variable
  • User-Specific Variable

Setup Environmental Variables for Java

After downloading and installing JDC(Java Development Kit) on your system. You can see that java files are not work because you have to specify the Java installation path on the environment variables. So the system can execute Java code in your Windows system.

Steps to Setup Environmental Variables :

Step 1 :  Open the C Drive and Click on Program Files.

C drive

Step 2 : In program files search and click on JAVA Folder.

Program Files

Step 3 : Inside the Java Folder you will find a JDK folder, Open it.

JDK Folder

Step 4 : Now click on jdk-20 Folder and copy the path

Java Development Kit

Step 5 : After that click on start button and search for Edit the environment system variables.

Environment System Variable

Step 6 : Open it and click on Environment Variables.

Environment Variables

Step 7: You will get two variables option. One is for user variables and system variables. Under the system variable section, select the “Path” variable and click on the “Edit” button.

Path Variables

Step 8 : Now you can see a new interface where you have to click on “New” and add the bin folder location. After that, click on “OK” to save the changes.

Environment Variable

Step 9 : Now, you have successfully installed it. To verify, open the command prompt and run the command.

Java Terminal

If the command returns the currently installed version of Java, that means; the Java environment variable is fully setup on your Windows system.

Thanks for reading. We hope that you setup your java environment variables. If you have any queries related to this article, leave a comment down below!

Suggested Readings!