How to set the environment variables for Java in Windows
To set environment variables for Java in Windows:
Press the Windows key + R on your keyboard to open the "Run" dialog.
Type "control panel" and press Enter.
In the Control Panel, click on "System and Security" and then click on "System".
In the left panel, click on "Advanced system settings".
In the "System Properties" window, click on the "Environment Variables" button.
Under the "System variables" section, scroll down and find the "Path" variable. Click on "Edit...".
In the "Edit environment variable" window, click on "New" and enter the path to your Java installation directory (e.g., "C:\Program Files\Java\jdk1.8.0_241\bin").
Click "OK" to save the changes.
Note: You may need to close and reopen any open command prompts for the changes to take effect.
Alternatively, you can also set the environment variables for Java using the command prompt:
Open the command prompt by pressing the Windows key + R on your keyboard, typing "cmd" and pressing Enter.
Type the following command and press Enter:
setx path "%path%;C:\Program Files\Java\jdk1.8.0_241\bin"
This will add the path to your Java installation directory to the "Path" environment variable.
- Close and reopen any open command prompts for the changes to take effect.