In this post, we will see about how to set java path in windows 10 using cmd. To set java path, you need to first understand about JAVA_HOME
and how to set JAVA_HOME in windows 10.
Table of Contents
What is JAVA_HOME?
JAVA_HOME
is environment variable which contains installation directory of Java development kit(JDK) or Java Runtime environment(JRE). This environment variable is setup at operating system level.
1 2 3 |
JAVA_HOME=C:\Program Files\Java\jdk-11.0.9 |
Why do you need JAVA_HOME?
JAVA_HOME environment variable points to directory where java is installed on your system, so many java based applications such as TOMCAT use JAVA_HOME environment variable to locate java executables.
How to set JAVA_HOME in Windows 10?
- Locate JDK on your machine.
- If you are using 64-bit java, then it will be in
C:\Program Files\Java\
- If you are using 32-bit java, then it will be in
C:\Program Files (x86)\Java\
- If you are using 64-bit java, then it will be in
- Open windows search, type
environment
and click onEdit the system environment variables
. - In System properties dialog, go to Advanced tab and click on button
Enviroment Variables
. - In System variables, click
NEW...
button to add JAVA_HOME environment variable. - Provide variable name as
JAVA_HOME
and value as Java installation directory.
Set java path in window 10
Now let’s see how to set java in path environment variable in windows 10.
- In System variable window, locate
Path
and click onEdit...
. - Double click on the empty row and add
%JAVA_HOME%\bin
.
Here,%
symbol is used to locate JAVA_HOME environemt variable and\bin
provides location forjava.exe
and h=javac.exe
- Close the command prompt and launch again.
- Check java version as below:
That’s all about How to set java path in windows 10.