Elastic Search Error – JAVA_HOME environment variable must be set!

When trying to get the Elastic Search running on a Windows 10 machine , there are times when you would hit with the below problem which is related to Java.

JAVA_HOME environment variable must be set!

If there are any java developers out there , then it would be easier for them to identify this issue. For all those who are new to Java , here’s the step to get it resolved.

How to Set Java_Home Environment on Windows 10 PC ?

1. Download and install the latest version of Java and JDK.

2. Navigate to the folder where the Java JDK is installed. This is generally in the path C:\Program Files\Java\ if the machine is a 64 bit machine . Incase of 32-bit machine , this will be C:\Program Files(x86)\Java\

Under this folder , identify the Java JDK installation and use that as the path (copy it) . In my case , the path is C:\Program Files\Java\jdk1.8.0_73

3. Navigate to the desktop , right click on “My PC” and select “Properties”.

image

4. Click “Advanced System Settings” in the left sidebar of the screen and select “Environment Variables.

image
5. In the Environment Variables Dialog , click “new” button in the System Variables.

SNAGHTML63d840c

6. In the Dialog , enter “JAVA_HOME” in the Variable Name and put the path of the JDK installation in the Variable Value and click OK.

7. Now , start the Elastic Search batch file . You should see the Elastic Search starting successfully now.