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 - For example, if you installed JDK 11, you might find a folder like jdk-11.x.x. ... In the System window, click on “Advanced system settings” on the left sidebar. In the System Properties window, click the “Environment Variables” button. 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.
🌐
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 - In the new window that appears, click on the New button under System variables. Type in JAVA_HOME in the Variable name box. For Variable value, type in the path to your JDK folder — in this example, the path is “C:\Program Files\Java\jdk-21
🌐
The Windows Club
thewindowsclub.com › the windows club › general › how to set java_home in windows 11/10
How to set JAVA_HOME in Windows 11/10
Now go back to the Environment Variable window and select Path under the System variable. Click on Edit button to open Edit environment variable window. Click on New button and type %JAVA_HOME%\bin.
Published   July 13, 2024
🌐
Mkyong
mkyong.com › home › java › how to set java_home on windows (step-by-step guide)
How to Set JAVA_HOME on Windows (Step-by-Step Guide) - Mkyong.com
July 29, 2025 - ... In the Windows search bar (next to the Start button), type advanced system settings, and click View advanced system settings. ... To make Java tools accessible from the command line, we must update the PATH variable.
🌐
Coding Lap
codinglap.com › home › how to add java to the path in windows 11
How to Add Java to the PATH in Windows 11 - Coding Lap
November 3, 2025 - Press Windows + S, type cmd, and click Run as Administrator. Type the following command and hit Enter: java -version ... java version "25.0.1"Java(TM) SE Runtime Environment (build 25.0.1+11-LTS)Java HotSpot(TM) 64-Bit Server VM (build 25.0.1+11-LTS, mixed mode) If the version number appears, congratulations — you’ve successfully added Java to PATH! Adding JAVA_HOME is useful for development tools like IntelliJ IDEA, Eclipse, or Maven.
🌐
GeekChamp
geekchamp.com › home › how to set java path in windows 11: a step-by-step guide
How to Set Java Path in Windows 11: A Step-by-Step Guide - GeekChamp
December 28, 2025 - Once you’ve identified the Java installation directory, note down the path as you’ll need it for setting the environment variables. The typical path looks similar to C:\Program Files\Java\jdk- ... Setting the JAVA_HOME environment variable correctly is essential for Java development and ...
Find elsewhere
🌐
GeekChamp
geekchamp.com › home › how to set java path in windows 11
How to Set Java Path in Windows 11 - GeekChamp
December 27, 2025 - Update the PATH Variable: Append %JAVA_HOME%\bin to your system’s Path variable. Do not delete existing entries. To do this, edit the environment variables, select Path, and click Edit to add the new entry. Use Command Prompt to Confirm: After setting variables, open a new Command Prompt window and run java -version and javac -version.
🌐
Solve Your Tech
solveyourtech.com › home › programs › how to set java path in windows 11: a step-by-step guide
How to Set Java Path in Windows 11: A Step-by-Step Guide
August 20, 2024 - In the System variables section, find the Path variable, select it, and click “Edit”. In the Edit Environment Variable window, click “New” and add %JAVA_HOME%bin.
🌐
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 JAVA_HOME and in the Variable value field, paste the copied address. Screenshot by Aman Kumar -- no attribution required ... Return to the Environment Variables window, select Path in the System variables section, and click Edit.
🌐
WebTech360
tips.webtech360.com › windows
Ultimate Guide: How to Set JAVA_HOME Environment Variable in Windows 11 Effortlessly
🚀 Open Command Prompt as Admin: Search for "cmd," right-click, and choose "Run as administrator." 📝 Set the Variable: Type setx JAVA_HOME "C:\Program Files\Java\jdk-21" /M (replace with your path).
🌐
TechBloat
techbloat.com › home › how to set java path in windows 11: a step-by-step guide
How to Set Java Path in Windows 11: A Step-by-Step Guide - TechBloat
May 16, 2026 - To set the Java path in Windows 11, install a full JDK, set JAVA_HOME to the root JDK folder, and add %JAVA_HOME%\bin to the Windows Path variable.
🌐
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 - In the System Properties window, select the Path variable under the System Variables section. Click Edit, and add %JAVA_HOME%\bin to the list of paths if it’s not already there.
🌐
TheServerSide
theserverside.com › feature › How-to-set-JAVA_HOME-in-Windows-and-echo-the-result
How to set JAVA_HOME in Windows | TheServerSide
The PATH variable points to \bin, while JAVA_HOME points to the root folder into which the JDK was installed. For those who prefer to use the command line, you can easily set JAVA_HOME on Windows with any terminal window, be it PowerShell, the ...
🌐
Specinnovations
help.specinnovations.com › configuring-java-home-on-windows
Configuring JAVA_HOME Environment Variable on Windows
In the New System Variable dialog, enter JAVA_HOME as the Variable name. Paste the copied JDK path (e.g., C:\Program Files\Java\jdk-17) into the Variable value field. ... Click OK to close the Edit or New System Variable dialog. Click OK again to close the Environment Variables dialog, and ...
🌐
javaspring
javaspring.net › blog › set-java-path-in-windows-11
Setting Java Path in Windows 11: A Comprehensive Guide — javaspring.net
# Switch to JDK 11 $env:Path = $env:JAVA_11_HOME + "\bin;" + $env:Path # Switch to JDK 17 $env:Path = $env:JAVA_17_HOME + "\bin;" + $env:Path · It's recommended to use system variables instead of user variables when setting the Java path. System variables are available to all users on the machine, which is useful in a multi-user environment or when running system-level Java applications. Setting the Java path in Windows 11 is a fundamental yet essential task for Java developers.
🌐
Wikihow
wikihow.com › computers and electronics › software › programming › java › how to set java_home on windows, linux, & mac
How to Set JAVA_HOME on Windows, Linux, & Mac
March 5, 2025 - To set JAVA_HOME, you'll need the full path to your JDK or JRE installation. On Windows, you'll set JAVA_HOME in Advanced System Settings > Environment Variables.
🌐
Atlassian
confluence.atlassian.com › doc › setting-the-java_home-variable-in-windows-8895.html
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.
🌐
Medium
medium.com › @aleksej.gudkov › how-to-get-openjdk-java-home-path-in-linux-macos-and-windows-0e4da01b595b
How to Get OpenJDK Java Home Path in Linux, macOS, and Windows | by UATeam | Medium
November 24, 2024 - Under System variables, click New and set the variable name to JAVA_HOME and the value to the Java path (e.g., C:\Program Files\AdoptOpenJDK\jdk-11.0.10.9-hotspot).