If you're doing any sort of development, or building with Maven or Ant, you need to point to the JDK (Java Development Kit) where utilities such as javac (the Java Compiler) reside. Otherwise, you can point to the JRE (Java Runtime Environment).

The JDK contains everything the JRE has and more. If you're just executing Java programs, you can point to either the JRE or the JDK.

Answer from David W. on Stack Overflow
๐ŸŒ
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)
On the Advanced tab, select Environment Variables, and then edit JAVA_HOME to point to where the JDK software is located, for example, C:\Program Files\Java\jdk1.6.0_02.
Discussions

How do I set JAVA_HOME ?
Java home basically is the full directory where your java exe and other related stuff is present. Your OS/windows doesnt know what or where java.exe is. So you need to tell it that hey, this is where you should look for java stuff. The OS use something known as an Environment Variable to store these things. Under Environment variables there are many default ones, โ€œpathโ€ variable is where the OS looks for an exe when you type some command. There can be multiple paths/folders in the path variable, just add your full directory of where you extracted/installed java java/bin to that variable. You can similarly also create new environment variables, create a new variable JAVA_HOME and set the path to the location of the java folder More on reddit.com
๐ŸŒ r/IntelliJIDEA
7
3
October 22, 2024
java - What is JAVA_HOME? How does the JVM find the javac path stored in JAVA_HOME? - Stack Overflow
Some third-party programs (for ... to be set to the installation directory of the JDK or JRE. If you are not using software that requires them, you do not need to set JAVA_HOME and JRE_HOME. PATH is an environment variable used by the operating system (Windows, Mac OS X, Linux) where it will look for native executable programs to run. You should add the bin ... More on stackoverflow.com
๐ŸŒ stackoverflow.com
December 31, 2014
Setting JAVA_HOME path
It means that you have not configured the JAVA_HOME environment variable. Using a virtual terminal application, type in: update-alternatives --config java, which will give you the location of JDK listed under Path column. Depending on the installed version of JDK, it will be something like: /usr/lib/jvm/java-14-openjdk-amd64/bin/java If you have installed multiple versions of JDK, all of them will be listed here 2. Using text editor such as nano and terminal emulator, type in: nano /etc/profile.d/jdk_home.sh This will create and open for editing a new script file named jdk_home.sh under the location /etc/profile.d, where you need to type in: export JAVA_HOME= where JDK-Location should not include the /bin/java directories. For example: EXPORT JAVA_HOME=โ€/usr/lib/jvm/java-14-openjdk-amd64โ€ This will set your environment variable JAVA_HOME The steps above are if you have installed JDK using apt package manager tool, you also have the option of using SDKMAN which will configure all environment variables for you automatically. More on reddit.com
๐ŸŒ r/vscode
12
1
February 27, 2020
I get "JAVA_HOME is not set" error even though it exists in System Environment Variables
First things first. Don't worry about uninstalling IntelliJ/Eclipse/whatever. You don't need to do that ๐Ÿ™‚ (though you might have needed to close your development environment (intelliJ) down and reopen it for it to become "aware" of your new JAVA_HOME variable. Not sure on that one though. But that leads me to my main answer to your question. I'm wondering if it could be the terminal window you're in that's the problem. I just want to check, are you using a terminal within IntelliJ? Or both IntelliJ and a separate terminal application like 'terminal', 'git bash', 'powershell', etc? If you're using a separate terminal and haven't opened a new window since you set JAVA_HOME, that terminal window will not be "aware" that you've set a new JAVA_HOME variable. I've encountered this, myself, before. More on reddit.com
๐ŸŒ r/javahelp
11
2
December 20, 2024
๐ŸŒ
Baeldung
baeldung.com โ€บ home โ€บ java โ€บ core java โ€บ java_home vs path environment variables
JAVA_HOME vs PATH Environment Variables | Baeldung
January 8, 2024 - Modern programs are intelligent enough to pick one of the JAVA_HOME or PATH variables to run successfully. However, a few other programs, such as Eclipse, need the PATH variable to startup. As a best practice, setting both the JAVA_HOME and PATH environment variables is always recommended.
๐ŸŒ
Planetary Data System
pds.nasa.gov โ€บ datastandards โ€บ training โ€บ documents โ€บ Finding and Setting JAVA HOME.pdf pdf
Finding and Setting JAVA HOME
same function as the Mac java_home program, you can replace the explicit directory listed in the ยท code samples above with a call to this routine. For example, in the C-shell: ... The same method works for Bourne-type shells. The back-ticks (the character under the tilde character on most US keyboards) indicate that the ยท command inside the ticks should be run and the result saved as the value of JAVA_HOME.
๐ŸŒ
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" Restart Command Prompt to reload the environment variables then use the following command to check the it's been added correctly.
๐ŸŒ
Tom Gregory
tomgregory.com โ€บ java-home-vs-path-environment-variables
JAVA_HOME vs. PATH Environment Variables | Tom Gregory
May 2, 2022 - Yeah I know, I've been calling it PATH instead of Path up to this point. But actually Windows environment variables aren't case sensitive, so no worries! Double click Path and it will bring up a list of all the directories contained in the variable. We need to add a new entry so hit New. You'll end up in a text box where you should enter the value %JAVA_HOME%\bin.
Find elsewhere
๐ŸŒ
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...
๐ŸŒ
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.

๐ŸŒ
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 ...
๐ŸŒ
Quora
quora.com โ€บ How-do-you-check-if-the-Java-path-is-correct-in-Windows
How to check if the Java path is correct in Windows - Quora
Answer: You need to set JAVA_HOME system environemtn variable You need to set path and classpath as well. Windows 7 โ€“ Right click My Computer and select Properties > Advanced Windows 8 โ€“ Go to Control Panel > System > Advanced System Settings Windows 10 โ€“ Search for Environment Variables ...
๐ŸŒ
Umd
sbnwiki.astro.umd.edu โ€บ wiki โ€บ Finding_and_Setting_JAVA_HOME
PDS: SBN Wiki Changes
May 18, 2017 - The information on the PDS4 Viewer is now available at pdssbn.astro.umd.edu/tools/pds4_tools_info/pds4_viewer.html .
๐ŸŒ
Blogger
javarevisited.blogspot.com โ€บ 2012 โ€บ 02 โ€บ how-to-set-javahome-environment-in.html
How to set JAVA_HOME environment in Linux, Unix and Windows? Example
This is one of the best and up-to-date courses to learn Java online. Setting JAVA_HOME on Unix or Linux environment is more easy and straightforward. you just need to export the JAVA_HOME variable and its value and then you can refer to its value in any shell script. Here is an example of how to set JAVA_HOME on Unix and Linux: ... Now Java is added to your system PATH by using the JAVA_HOME System variable.
๐ŸŒ
Javatutorial
javatutorial.net โ€บ set-java-home-windows-10
How to set JAVA_HOME in Windows 10 | Java Tutorial Network
Hi Jon, Please look again at point 3 of this tutorial. To be able to call javac the way you try it, you need to add %JAVA_HOME%\bin in your System Path.
๐ŸŒ
IBM
ibm.com โ€บ docs โ€บ en โ€บ b2b-integrator โ€บ 5.2.0
Setting Java variables in Windows - IBM Documentation
September 23, 2022 - Enter JAVA_HOME as the variable name. Enter the path to the JDK as the variable value.
๐ŸŒ
Kodejava
kodejava.org โ€บ how-do-i-setup-java_home-and-path-variables-in-windows
How do I set up JAVA_HOME and Path variables in Windows? - Learn Java by Examples
A new Environment Variables window will be shown. Under the System Variables, click the New button to create a new environment variable. Enter the variable name as JAVA_HOME, all letters are in uppercase. In the variable value enter the JDK installation path youโ€™ve copy above.
๐ŸŒ
Quora
quora.com โ€บ What-is-the-use-of-JAVA_HOME
What is the use of JAVA_HOME? - Quora
Answer: Many Java Frameworks/ Servers depend on this environment variable to find and start the JVM. This standard way to let know others where your JVM resides.
๐ŸŒ
Jamf
jamf.com โ€บ jamf-nation โ€บ articles โ€บ 348 โ€บ configuring-the-java_home-and-jre_home-environment-variables-on-a-windows-server
Technical Articles
February 1, 2018 - This article explains how to configure role-based local account creation on Mac computers using Azure AD and Jamf Connect ยท PreStage Enrollment: Users Are Not Volume Owners on Computers with macOS 11.5โ€“12 when the Recovery Lock Password is Set During Enrollment (PI-010304)