Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hadoop on Windows - "Error JAVA_HOME is incorrectly set."

I'm trying to get Hadoop running 'Local Mode' on my Windows machine. I've been using this guide: http://hadoop.apache.org/docs/r1.2.1/single_node_setup.html

When I run the command: bin/hadoop, I get the following error message:

Error: JAVA_HOME is incorrectly set. Please update C:...\hadoop-2.7.1\conf\hadoop-env.cmd

Inside hadoop-env.cmd, I have the line: set JAVA_HOME=%JAVA_HOME%

When I type echo %JAVA_HOME% at the command line I get: C:\Java\jdk1.0.8_51

Even if I change the line in hadoop-env.cmd to: set JAVA_HOME=C:\Java\jdk1.0.8_51 I get the same error...

How could it be that my JAVA_HOME is incorrectly set?

like image 387
Joseph Palermo Avatar asked Jul 24 '15 23:07

Joseph Palermo


People also ask

Where is JAVA_HOME set windows?

Set JAVA_HOME: Right click My Computer and select Properties. On the Advanced tab, select Environment Variables, and then edit JAVA_HOME to point to where the JDK software is located, for example, C:\Program Files\Java\jdk1.


2 Answers

 set JAVA_HOME=C:\Program Files\Java\jdk1.8.0_131\

Above configuration was throwing same error as yours. I updated above with below in hadoop-env.cmd which is infact SFN

set JAVA_HOME=C:\Progra~1\Java\jdk1.8.0_131\

This allowed me to change/have different java version than that of system.

like image 73
Jabir Avatar answered Sep 22 '22 10:09

Jabir


if your java environment path contains space, such as "C:\Program Files\java\xxxxx" , the word 《Program Files》 contains a space, so CMD can't identificate

this is the right answer

like image 43
PeaSir Avatar answered Sep 25 '22 10:09

PeaSir