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

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

Modify the environment variable.

Copysetx -m JAVA_HOME "C:\Program Files\Java\jdk1.8.0"
setx -m PATH "%PATH%;%JAVA_HOME%\bin";
Answer from Sathiamoorthy on Stack Overflow
🌐
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
Set the value of the environment variable to your JDK (or JRE) installation path as follows: setx /m JAVA_HOME "C:\Program Files\Java\jdk11.0.17.8"
🌐
Oracle
docs.oracle.com › cd › E19182-01 › 821-0917 › inst_jdk_javahome_t › index.html
Installing the JDK Software and Setting JAVA_HOME (Using the GlassFish ESB Installation GUI)
export JAVA_HOME=jdk-install-dir · export PATH=$JAVA_HOME/bin:$PATH · For the bourne shell, run the following commands: JAVA_HOME=jdk-install-dir · export JAVA_HOME · PATH=$JAVA_HOME/bin:$PATH · export PATH · For the C shell, run the following commands: setenv JAVA_HOME jdk-install-dir ·
🌐
Specinnovations
help.specinnovations.com › configuring-java-home-on-windows
Configuring JAVA_HOME Environment Variable on Windows
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 then OK to close the System Properties window. Example: For a JDK installed at C:\Program Files\Java\jdk-21...
Find elsewhere
🌐
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.
🌐
Tom Gregory
tomgregory.com › java-home-vs-path-environment-variables
JAVA_HOME vs. PATH Environment Variables | Tom Gregory
May 2, 2022 - Other programs, such as the Eclipse IDE, need at least the PATH in order to startup. For the best compatibility with new and old programs that use Java always set both JAVA_HOME and PATH.
🌐
TheServerSide
theserverside.com › feature › How-to-set-JAVA_HOME-in-Windows-and-echo-the-result
How to set JAVA_HOME in Windows | TheServerSide
Remember that JAVA_HOME points to the root folder into which the JDK was installed. Do not point JAVA_HOME to the \bin directory of the install. The PATH variable points to \bin, while JAVA_HOME points to the root folder into which the JDK was ...
🌐
Planetary Data System
pds.nasa.gov › datastandards › training › documents › Finding and Setting JAVA HOME.pdf pdf
Finding and Setting JAVA HOME
Then insert the path you found previously. ... different variations on the C-shell. We'll show syntax for both of those here. (Do "echo $SHELL" from · the command line to see what shell you are running if you don't know, and "man shell" on the shell ... Alternately, if you are on a Mac, or a friendly programmer has written you a routine that performs the · same function as the Mac java_home program, you can replace the explicit directory listed in the
🌐
Red Hat
access.redhat.com › solutions › 1445833
How to set the JAVA_HOME environment variable? - Red Hat Customer Portal
It should point to the directory containing a bin/java executable. As the user who will use OpenJDK or any JDK vendor, open the shell configuration file. For the bash shell, this file is /home/username/.bashrc. At the bottom of the file, type the following line, replacing the hypothetical path with the actual path to use on the operating system: export JAVA_HOME="/path/to/java/home".
🌐
Baeldung
baeldung.com › home › java › core java › java_home vs path environment variables
JAVA_HOME vs PATH Environment Variables | Baeldung
January 8, 2024 - Here’s how we set the JAVA_HOME variable through the command-line: ... Alternatively, we can also set this variable through system settings. Windows users can find this setting under the System Properties -> Advanced -> Environment Variables. The operating system uses the PATH environment variable to find the native executable programs to run.
🌐
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 - Now that you have the location of Java, you can add the path to your .bashrc file (if you're using the bash shell), .zshrc (for the zsh shell), or the equivalent for your shell.[3] X Research source Run both of the following commands, replacing the path with the path to your JDK or JRE installation, and "bashrc" with your shell's login script: echo "export JAVA_HOME=/usr/lib/jvm/java-23-openjdk-arm64" >> ~/.bashrc
🌐
Reddit
reddit.com › r/intellijidea › how do i set java_home ?
r/IntelliJIDEA on Reddit: How do I set JAVA_HOME ?
October 22, 2024 -

Hello! I'm very (very) new to programming. I'm following a tutorial by Kaupenjoe to make (what I thought would be) a very simple Minecraft mod. But when I get to the step in the tutorial at 12:30 and run the terminal command ./gradlew genIntellijRuns, I receive the following error message. I'm still trying to figure out how all of this works, so pardon my ignorance if this is a stupid question, but I cannot for the life of me find how to correct this error. Could anyone walk me through it, please?

ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.

Please set the JAVA_HOME variable in your environment to match the location of your Java installation.

🌐
Oracle
java.com › en › download › help › path.html
How do I set or change the PATH system variable?
To run a different version of Java, either specify the full path, or use the java_home tool:
🌐
GitConnected
levelup.gitconnected.com › quick-way-to-set-java-home-in-mac-70cd4e82a9c5
Quick way to set JAVA_HOME in mac | by Vishnu | Level Up Coding
November 23, 2023 - Start by checking if JAVA_HOME is already set on your system. ... If this returns a path, JAVA_HOME is already set.