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.
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.
From: Marco Antonio mailto:hidden email Subject: Re: How to set JAVAOPTS variable in tomcat6.0.16 Hi, just need to have the variable JAVAOPTS exported. # export JAVAOPTS='-Xms1024m -Xmx1024m' That works for Linux (except for the leading # that turns it into a comment), but says nothing for Windows script or service usage. The JAVAOPTS environment variable. When using the following commands, additional options can be passed to the Java virtual machine by setting the JAVAOPTS environment variable before the command is executed.
and under the Java
directory the JDK is residing.
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.
Java_opts Environment Variable Definition
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 FilesJavajdk-12
in this example. Then we will click OK.
Java Set Environment Variable Runtime
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 FilesJavajdk-12bin
in this example.
Then we will click OK
and OK
in the environment variables screen which will save and activated new path configuration.
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.