Hadoop on Windows - "JAVA_HOME Error Installed Incorrectly."

I am trying to get Hadoop to run Local Mode on my windows machine. I am 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 not installed correctly. Please update C: ... \ Hadoop-2.7.1 \ conf \ Hadoop-env.cmd

Inside hadoop-env.cmdI have a line: set JAVA_HOME=%JAVA_HOME%

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

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

How could it happen that mine is JAVA_HOMEinstalled incorrectly?

+6
source share
7 answers

If your JAVA_HOME path contains spaces, you should use the Windows 8.3 Path

+15
source

Like the other answers, your Java environment path should not contain a space. The solution is as follows:

  1. In the cmd line, specify the directory containing jdk (in my case C: \ Program Files \ Java \ jdk1.8.0_73).
  2. run the following line "for% i in (.) do echo% ~ sI" to display the short name of the jdk you installed (in my case C: \ PROGRA ~ 1 \ Java \ JDK18 ~ 1.0_7)
  3. in the file "hadoop-env.cmd" change the line "JAVA_HOME =% JAVA_HOME%" to "JAVA_HOME = C: \ PROGRA ~ 1 \ Java \ JDK18 ~ 1.0_7".
  4. run the hadoop-env.cmd file again and it will work correctly.
+10
source

"% JAVA_HOME%" conf\hadoop-env.cmd

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

, . hadoop-env.cmd, SFN

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

/ Java, .

+2

@ @rem hadoop-env.cmd JAVA_HOME =% JAVA_HOME%

rem The java implementation to use.  Required.

set JAVA_HOME =% JAVA_HOME%

hdfs namenode -format

+1

Java , "C:\Program Files\java\xxxxx", "Program Files" , CMD

0

hadoop-config.xml,

if% JAVA_HOME% \ bin \ java.exe does not exist (echo Error: JAVA_HOME is not installed correctly. echo Update% HADOOP_HOME% \ conf \ hadoop-env.cmd goto: eof)

if your path to the Java environment contains space, for example, "C: \ Program Files \ java \ xxxxx", the word "Program Files" contains a space, so CMD cannot identify

SO can change the path instead.

-2
source

Source: https://habr.com/ru/post/1599595/


All Articles