Java is a very popular programming language which provides a different component in order to run, develop Java applications. JRE or Java Runtime Environment is used to run Java application. JDK or Java Development Kit is used to develop Java applications. In this tutorial, we will learn how to set up Java, JRE, and JDK operating system path variables in order to work properly.
Locate JRE or JDK Path
Before starting the configuration we have to locate the JRE or JDK path. JRE or JDK generally installed on the Program Files
or Program Files(x86)
directory under the Java directory like below.

and under the Java
directory the JDK is residing.

Set Java HOME_PATH Environment Variable
Now we have learned the path of the Java, JRE or JDK installation. We can set this path as Java HOME_PATH environment variable. We will open the computer properties with by running sysdm.cpl
in the Run menu like below. We can also open it from the File Explorer -> Computer -> Right Click.

In the system properties, we will navigate to the Advanced
tab which provides the Environment Variables
button like below.

Below we can see the environment variables menu where we will create the JAVA_HOME
system variable and set the path accordingly. We click to the New
in order to create a new system variable.

Here we will set the Variable Name
as JAVA_HOME
and the Variable Value
the path or Java, JRE or JDK which is C:\Program Files\Java\jdk-12
in this example. Then we will click OK.

Set JAVA Executable Path
If we want to run java.exe
or similar executables provided by JRE or JDK we have to add the path of Java in the Path
variable like below. We select the system variable named Path
and click to the Edit
.

Here we click to New
which will add a new line to the existing values.
Here we will set the bin
folder path which is C:\Program Files\Java\jdk-12\bin
in this example.

Then we will click OK
and OK
in the environment variables screen which will save and activated new path configuration.
Check Java Is Working
We can check the new path configuration simply opening a new command line interface MS-DOS. Then just type java -version
which will execute java.exe
with the -version
option. We can see the current java binary version by running it.
What is the point in setting the JAVA_HOME to the path to the jdk install folder path if you then edit the Path variable and add the full path to the jdk bin folder? Shouldn’t you make use of the JAVA_HOME variable and add %JAVA_HOME%\bin to the Path instead.
@James Coffey, maybe the point of setting JAVA_HOME is just in preparation for GlassFish:
https://docs.oracle.com/cd/E19182-01/820-7851/inst_cli_jdk_javahome_t/index.html
Still, the author could make use of it in Path as you say, but maybe the author is just trying to keep it simple.
THANK YOU SO MUCH!!! YOU SAVED MY LIFE. I need to use java in jupyter