How to Setup Environment Variables for Java in Windows 11

vote/تقييم

In this guide, we will learn: How to Setup Environment Variables for Java in Windows 11 – guide 2023

If you have installed Java on your Windows 11 and facing an error due to an environment variable, you are at the right place. It can cause if you have not set the environment variable for the Java bin folder path. Here we will discuss; how to set up the environment variable on 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 variables: system variables and user variables. One is system-specific, and the other one is user-specific. They play an important role in the Windows operating system.

How to Setup Environment Variables for Java in Windows 11

By just downloading and installing Java SE Development Kit on your system, Java files will not work. You have to specify the Java installation path on the environment variable. So, the system can execute Java code on your Windows 11 system.

Here are the steps to set up an environment variable for Java:

Step 1: Open C Drive > Program Files folder and look for the Java folder and open it.

Step 2: Inside the Java folder, you will find a JDK folder, open it and open the bin folder. Now copy the path of the bin folder location.

Step 3: After that, click on the windows icon to open the “Start Menu” and click on “Settings.”

Step 4: Next, click on the “System” tab from the left panel of the Settings window. Then, look for an option called “About” and click on that option present to the right of your screen.

Step 5: Now, you will get all your device specifications. Click on the “Advanced system settings” option; to access the “System Properties.” 

Step 6: It will open the system properties window. Click the “Advanced” tab and select “Environment Variables” to open the variables windows.

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.

Step 8: Now click “New” and add the bin folder location. After that, click on “OK” to save the changes.

Step 9: To verify, open the command prompt and run the following command one by one:

java --version
javac

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

Conclusion

That’s it; this is how you can set up environment variables for Java in Windows 11. You can also check our detailed guide on; how to set the JAVA_HOME variable on Windows 11.

I hope this article was helpful to you. If you liked the article, share it with your friends and family. If you have some suggestions, do not hesitate to leave them in the comments section below.

If this guide helped you, please share it. 🙂

Leave a Comment