If you don't have admin rights, use the below command to set environment variables for java using the command prompt

setx JAVA_HOME "C:\Program Files\Java\jdk1.8.0"
setx PATH "%PATH%;%JAVA_HOME%\bin";

Modify the environment variable.

setx -m JAVA_HOME "C:\Program Files\Java\jdk1.8.0"
setx -m PATH "%PATH%;%JAVA_HOME%\bin";
Answer from Sathiamoorthy on Stack Overflow
🌐
Medium
azimuahamed.medium.com › java-environment-variables-setup-windows-11-58fe71e43b5e
JAVA Environment Variables Setup Windows 11 | by Azim Uddin Ahamed | Medium
August 1, 2024 - In the Environment Variables window, under the “System variables” section, click “New.” · For the “Variable name,” enter JAVA_HOME. For the “Variable value,” enter the path to your JDK installation directory.
🌐
Oracle
java.com › en › download › help › path.html
How do I set or change the PATH system variable?
Reopen Command prompt window, and run your java code. From the desktop, right click the Computer icon. Choose Properties from the context menu. Click the Advanced system settings link. Click Environment Variables. In the section System Variables find the PATH environment variable and select it.
🌐
Oracle
docs.oracle.com › cd › F74770_01 › English › Installing › p6_eppm_install_config › 89522.htm
Setting an Environment Variable for Java
February 2, 2024 - ... In the System Variables section, click New. In the Variable name field, enter JAVA_HOME. In the Variable value field, enter the location where the JDK software is installed (for example, C:\Program Files\Java\<java_version>) ... In the System Variables section, select the PATH variable, ...
🌐
TheServerSide
theserverside.com › feature › How-to-set-JAVA_HOME-in-Windows-and-echo-the-result
How to set JAVA_HOME in Windows | TheServerSide
Click on the Environment Variables button. Click on the New button under System Variables. Set JAVA_HOME as the environment variable name.
🌐
XDA Developers
xda-developers.com › home › windows11 › how to set the java path in windows 11
How to set the Java path in Windows 11
November 29, 2023 - Next, click New, and now add your bin path — in this example, it would be “C:\Program Files\Java\jdk-21\bin” · Hit OK, hit OK again, and you’re done! You are now ready to build Java apps on your Windows 11 computer.
🌐
Quora
quora.com › What-environment-variables-should-be-set-for-Java-PATH
What environment variables should be set for Java PATH? - Quora
Answer: set the Temporary Path of JDK in Windows To set the temporary path of JDK, you need to follow the following steps: * Open the command prompt * Copy the path of the JDK/bin directory * Write in command prompt: set path=copied_path for e.g - set path=C:\Program Files\Java\jdk1.6.0_23\b...
Find elsewhere
🌐
Computer Hope
computerhope.com › issues › ch000549.htm
How to Set the Path and Environment Variables in Windows
Learn how to set the path and environment variables in Windows 11, 10, 8, 7, and older versions. Step-by-step guide with screenshots and tips.
🌐
MakeUseOf
makeuseof.com › home › windows › how to set up the java_home variable on windows 11
How to Set Up the JAVA_HOME Variable on Windows 11
September 22, 2023 - In the Variable name field, type ... required ... Return to the Environment Variables window, select Path in the System variables section, and click Edit....
🌐
Oracle
docs.oracle.com › javase › tutorial › essential › environment › paths.html
PATH and CLASSPATH (The Java™ Tutorials > Essential Java Classes > The Platform Environment)
If one of these variables is listed in the Environment Variables window from the Control Panel (such as JAVA_HOME), then you can edit its value. If it does not appear, then it is a special environment variable that the operating system has defined. For example, SystemRoot is the location of the Microsoft Windows system folder. To obtain the value of a environment variable, enter the following at a command prompt. (This example obtains the value of the SystemRoot environment variable): ... You can run the JDK just fine without setting the PATH variable, or you can optionally set it as a convenience.
🌐
Baeldung
baeldung.com › home › java › set java_home variable in windows, mac os x, and linux
Set JAVA_HOME on Windows 7, 8, 10, Mac OS X, Linux | Baeldung
March 26, 2025 - Click OK to apply the changes and restart the computer to ensure the changes take effect. Open Search and type advanced system settings. In the shown options, select the View advanced system settings link.
🌐
Scribd
scribd.com › doc › 234729997 › Updating-the-PATH-Environment-Variable
Set Java PATH on Windows 11 | PDF
The steps are to open the System Properties, click Advanced, then Environment Variables to edit the PATH variable and append the JDK bin folder path separated by semicolons. Setting the PATH variable this way allows Java programs to be run from ...
🌐
Specinnovations
help.specinnovations.com › configuring-java-home-on-windows
Configuring JAVA_HOME Environment Variable on Windows
Click the Environment Variables ... environment variables may require elevated permissions. The JAVA_HOME variable must be created or updated in the System variables section to point to the JDK installation path....
🌐
Atlassian
confluence.atlassian.com › spaces › DOC › pages › 8895 › Setting+the+JAVA_HOME+Variable+in+Windows
Setting the JAVA_HOME Variable in Windows | Confluence Data Center 10.2 | Atlassian Documentation
setx /m JAVA_HOME "C:\Program Files\Java\jdk11.0.17.8" Restart Command Prompt to reload the environment variables then use the following command to check the it's been added correctly. ... You should see the path to your JDK (or JRE) installation.
🌐
OrcaCore
orcacore.com › home › advanced windows › install java and set the path on windows 11 efficient steps
Install Java and Set the PATH on Windows 11 Efficient Steps
November 11, 2024 - To do this, you need to open the system environment path. Open system properties. Navigate to the Advanced tab and click on Environment Variables. Under user variables, click on New.
🌐
IBM
ibm.com › docs › en › b2b-integrator › 6.2.0
Setting Java variables on Windows
JAVA_HOME and PATH variables are required for the operating system to find the required Java programs and utilities.
🌐
GeeksforGeeks
geeksforgeeks.org › java › setting-environment-java
Setting up Environment Variables For Java - Complete Guide to Set JAVA_HOME - GeeksforGeeks
May 9, 2025 - Now, go to Environment Variable > System Variable section > click New. ... In the Variable name field, enter JAVA_HOME and in the Variable value field enter the path where the JDK is installed.