'getting JAVA_HOME is incorrectly set with hadoop
I just downloaded hadoop and unzipped the file. but when I run hadoop version command from command prompt , I'm getting below error . I double check and JAVA_HOME is set to "C:\Program Files\Java\jdk1.8.0_45\bin" which looks ok to me .
C:\Users\shri-pc>hadoop version
The system cannot find the path specified.
Error: JAVA_HOME is incorrectly set.
Please update C:\JAVA\hadoop-2.6.0\conf\hadoop-env.cmd
'-Xmx512m' is not recognized as an internal or external command,
operable program or batch file.
Output of java -version command is coming properly . Please advice .
C:\Users\shri-pc>java -version
java version "1.8.0_51"
Java(TM) SE Runtime Environment (build 1.8.0_51-b16)
Java HotSpot(TM) Client VM (build 25.51-b03, mixed mode)
Solution 1:[1]
Your JAVA_HOME should not include bin. Change it from
"C:\Program Files\Java\jdk1.8.0_45\bin"
to
"C:\Program Files\Java\jdk1.8.0_45"
And you can add it to your path (in Windows) like
set "PATH=%PATH%;%JAVA_HOME%\bin"
Solution 2:[2]
Issue was with space in JAVA_HOME path . I change the path as below and it started working.
from -
"C:\Program Files\Java\jdk1.8.0_45\bin"
to -
"C:\PROGRA~1\Java\jdk1.8.0_45\bin"
.
Solution 3:[3]
If your JAVA_HOME is Program Files then change it to PROGRA~1 in JAVA_HOME environment variable.
Solution 4:[4]
Try changing the path from
C:\Program Files\Java\jdk1.8.0_45
to
C:\PROGRA~1\Java\jdk1.8.0_45.
Solution 5:[5]
To me it worked to go to the java path and convert it to the windows short name, as indicated in this picture:
https://www.joe0.com/wp-content/uploads/2017/02/word-image-30.png
from this site:
https://www.joe0.com/2017/02/02/how-to-install-a-hadoop-single-node-cluster-on-windows-10/
Solution 6:[6]
Space in the path will not work. Simply remove any spaces in the path.
In my case it is working with:
set JAVA_HOME=C:\Progra~1\Java\jdk1.8.0_261
Solution 7:[7]
1)There should not be any spaces in your path.
2)While setting-up java environment variables, JAVA_HOME should not contain '/bin'. Java-path should not contain the '/bin'. Also, ensure that your Java-8 path is on the top of all java versions you have in your system.
3)The same path should be updated in your Hadoop environment variable set-up. That is in the Hadoop-env file--->near JAVA_HOME
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Elliott Frisch |
| Solution 2 | Shri S Softwares |
| Solution 3 | Aman Tandon |
| Solution 4 | baduker |
| Solution 5 | Kenny Monar |
| Solution 6 | Kallol Bosu Roy Choudhuri |
| Solution 7 | divyateja raj |
