Shri S Softwares
Shri S Softwares

Reputation: 1529

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)

Upvotes: 20

Views: 28307

Answers (7)

divyateja raj
divyateja raj

Reputation: 1

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

Upvotes: 0

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

Upvotes: 1

Pathum Goonathilake
Pathum Goonathilake

Reputation: 71

Try changing the path from

C:\Program Files\Java\jdk1.8.0_45

to

C:\PROGRA~1\Java\jdk1.8.0_45.

Upvotes: 6

Aman Tandon
Aman Tandon

Reputation: 1509

If your JAVA_HOME is Program Files then change it to PROGRA~1 in JAVA_HOME environment variable.

Upvotes: 9

Kenny Monar
Kenny Monar

Reputation: 15

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/

Upvotes: 0

Shri S Softwares
Shri S Softwares

Reputation: 1529

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"

.

Upvotes: 54

Elliott Frisch
Elliott Frisch

Reputation: 201439

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"

Upvotes: 14

Related Questions