How to set java path in windows 10

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.

Let’s first understand about JAVA_HOME and then we will see how to set JAVA_HOME in windows 10.

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.

💻 Awesome Tech Resources:
  • Looking for ⚒️ tech jobs? Go to our job portal.
  • Looking for tech events? Go to tech events 🗓️ Calendar.️

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?

  1. 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\
  2. Open windows search, type environment and click on Edit the system environment variables.

    Edit environment variable in java

  3. In System properties dialog, go to Advanced tab and click on button Enviroment Variables.

    Click on Edit environment variable

  4. In System variables, click NEW... button to add JAVA_HOME environment variable.

    Add new environment variable

  5. Provide variable name as JAVA_HOME and value as Java installation directory.

    Set Java home environment variable

Set java path in window 10

Now let’s see how to set java in path environment variable in windows 10.

  1. In System variable window, locate Path and click on Edit....

    Click on edit

  2. Double click on the empty row and add %JAVA_HOME%\bin.

    Set java path in windows 10
    Here, % symbol is used to locate JAVA_HOME environemt variable and \bin provides location for java.exe and h=javac.exe

  3. Close the command prompt and launch again.
  4. Check java version as below:

    Check java version

That’s all about How to set java path in windows 10.

Related Posts

  • 22 May

    Difference between PATH and CLASSPATH in java

    In this post , we will see differences between PATH and CLASSPATH in java. Let me provide simple definition about PATH and CLASSPATH. PATH : This is environment variable which operating system uses to locate executable such as javac, java, javah,jar etc. For example: bin directory of jdk has all the executable such as javac,java […]

Leave a Reply

Your email address will not be published. Required fields are marked *

Subscribe to our newletter

Get quality tutorials to your inbox. Subscribe now.