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
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 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.