Hadoop installation on windows
Asked Answered
D

18

26

After extracting hadoop in my C drive I tried to execute the hadoop version command and getting below error. JAVA_HOME is set correctly in my environment variable. Can anybody help on that error ?

C:\>hadoop version 

The system cannot find the path specified.
Error: JAVA_HOME is incorrectly set.
Please update C:\hadoop-2.5.1\conf\hadoop-env.cmd '-Xmx512m' is not recognized as an internal or external command, ooperable program or batch file.
Dreamy answered 18/11, 2014 at 8:59 Comment(0)
E
29

Most of the answers suggest to copy the JDK installation path. However, if you are not comfortable doing it, you can use the Windows short path to set the path name so that all applications can access the path without any hassles.

Notion to set env variable if it contains white spaces:

Progra~1 = 'Program Files'
Progra~2 = 'Program Files(x86)'
Electrothermics answered 12/10, 2015 at 20:2 Comment(1)
Worked like a charm!Camillacamille
W
22

Just faced the same issue (Win 8.1 + Hadoop 2.7.0 [build from sources]).

The problem turned out to be (ol' good) space in path name where java is located (under C:\Program Files\ dir). What i did was this:

1) Copy JDK dir to C:\Java\jdk1.8.0_40

2) edit \etc\hadoop\hadoop-env.cmd and change: set JAVA_HOME=c:\Java\jdk1.8.0_40

3) run cmd and execute hadoop-env.cmd

4) now check 'hadoop version' whether it's still complaining (my wasn't)

Whitefly answered 9/5, 2015 at 17:53 Comment(0)
G
18

Install the JDK to a folder with no spaces. Instead of C:\Program Files\Java\jdk1.8.x_xx, try C:\java\jdk1.8.x_xx.

Goidelic answered 13/3, 2015 at 18:6 Comment(2)
What year is it? Seriously this kind of thing still breaks in a mature installation of anything??? Color me surprised.Strapped
It's 2020 and its still breakingHysell
N
5

The reason for you error is the space between the "Program Files". Replace it with PROGRA~1 in all the paths while configuring

Niple answered 18/2, 2016 at 0:15 Comment(0)
H
4

Check your JAVA_HOME.

If it is C:\Program Files\Java\jdk1.7.0_65. Then you will encounter such issues. Made it to C:\MyDrive\Java\jdk1.7.0_65 and it worked out. The space in "Program Files" creates issues.

PATH is PATH;%JAVA_HOME%\bin

If you are using windows, then surely You are going to face issues like (due to X64 and X86 issues) :

1 .

FATAL datanode.DataNode: Exception in secureMain java.lang.NullPointerException and

2.

FATAL namenode.NameNode: Failed to start namenode. java.lang.UnsatisfiedLinkError: org.apache.hadoop.io.nativeio.NativeIO$Windows.access0(Ljava/lang/String;I)

Solution :

Copy these files hadoop.dll, hadoop.exp, hadoop.lib, hadoop.pdb, libwinutils.lib, winutils.exe, winutils.pdb from the link to your bin folder of hadoop installed loaction which looks like this. ..\HadoopInstalled\hadoop\hadoop-2.6.0\hadoop-2.6.0\bin

Horehound answered 27/5, 2015 at 10:36 Comment(0)
G
4

To get around having to install another JDK in a path that does not have a space, you can create a symbolic link with the Windows command mklink. Here's how.

  1. Open a cmd prompt as administrator.
  2. Navigate to C:\ if the cmd prompt does not open there.
  3. Create the symolic link. Here, I'm setting the path that Hadoop complains about (with Program Files) to a simpler path without spaces. The /D argument means you are creating a directory symbolic link.

    mklink /D \java_home "C:\Program Files\Java\jdk1.7.0_65"

  4. In your hadoop-env.cmd, set your JAVA_HOME to the symbolic link you created:

    set JAVA_HOME=\java_home

This is what worked for me. More information on creating symbolic link in Windows: http://www.windows7home.net/how-to-create-symbolic-link-in-windows-7/

Galloromance answered 16/5, 2016 at 19:58 Comment(0)
B
3

Please add following line in hadoop-env.cmd. This should be first line in hadoop-env.cmd after comments.

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

This shortened Progra~1 name is SFN

This sans need for copying java to some other directory as purposed in some other answers and you can have java version which is specific for hadoop.

Blasted answered 15/8, 2018 at 13:26 Comment(1)
I tried your suggestion, when typing "hadoop version" in command window, I got the following message:Sample
G
2

Add your java bin location to your path environment variable. like

path = path;$JAVA_HOME/bin
Gallo answered 18/11, 2014 at 10:1 Comment(1)
This should work but unfortunately I wasted an hour trying to tweak environment variables with no success. Finally copying java to a "no spaces" path worked.Froward
B
2

The solution to this problem is simple

Most of the folks will be setting the JAVA_HOME as C:\Program Files\Java\jdk1.8.0_121

There problem here is with the spaces and what you need to do is , copy the contentd of jdk1.8.0_121 to a folder in C Drive , say C:\java

Now use this path as your JAVA_HOME

Brink answered 12/3, 2017 at 9:43 Comment(0)
D
1

open command prompt and try this... echo %JAVA_HOME% then check java home set or not. If not set java home.

Check here how to set JAVA_HOME in windows

Donation answered 18/11, 2014 at 12:2 Comment(0)
C
1

I have also faced similar issue, following steps solved error for me.

Download & Install Java in c:/java/

(make sure the path is this way, if java is installed in program files, then hadoop-env.cmd will not recognize java path )

Download Hadoop binary distribution.

Set Environment Variables:

JAVA_HOME = "c:/Java"
HADOOP_HOME="<your hadoop home>"
Path= "JAVA_HOME/bin"
Path = "HADOOP_HOME/bin" 

Here is a GitHub link, which has winutils of some versions of Hadoop.

(if the version you are using is not in the list, the follow the conventional method for setting up Hadoop on windows - link)

If you found your version, then copy paste all content of folder into path: /bin/

Set all the .xml configuration files - Link

And Finally set JAVA_HOME path in hadoop-env.cmd file

Probably it will solve 'JAVA_HOME is incorrectly set.' error

Hope this helps.

Calotte answered 5/12, 2017 at 8:51 Comment(0)
B
1

Error:

>>hadoop version
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.
HADOOP_HDFS_HOME not found

I suppose the issues could be any of the following:

  • You haven't set a path to the executable files of the program that you're trying to run.
  • The path that is set, is broken and your target executable does not exist there.
  • You may have set the path to the program and then change the location of that program on your file system or the path was never set in the first place.

My suggestions to do:

  • Check the path while you set up the environment variables.
  • Both the java folder and Hadoop folder should be placed in a single drive. So, check the path of both the java folder and Hadoop folder.
  • Check the paths you added while editing the hdfs-site.xml file.
  • Check the path you added while editing Hadoop-env.cmd

Note: Check out this article for further reference. https://medium.com/analytics-vidhya/hadoop-setting-up-a-single-node-cluster-in-windows-4221aab69aa6

Behl answered 3/3, 2021 at 16:18 Comment(0)
M
0

You can debug the hadoop.cmd file in bin folder, there may be some command which have syntax issue or improper path provided.

Open the hadoop.cmd file and see the first line "@echo off" will be there.Change "@echo off" to "@echo on" and save it. Run the "hadoop -version" command now. It will show you for which command the "syntax of the command is incorrect" error is coming. Correct it, if syntax problem is there or some path issue may be.

Marplot answered 8/10, 2017 at 4:31 Comment(0)
G
0

"@echo on" will help us to trace the error. The message is appearing from hadoop-config.cmd file. Pls copy the C:\Program Files\Java to C:\Java and change the path and try. This will work.

Gasser answered 17/11, 2017 at 18:32 Comment(0)
S
0

Just remove the bin folder in hadoop-env.cmd file(C:\hadoop-2.8.0\etc\hadoop\hadoop-env.cmd) "C:\Java\jdk-9.0.1\bin" and set the path which I mentioned below. this worked for me.

set JAVA_HOME="C:\Java\jdk-9.0.1"
Stefanysteffane answered 4/11, 2018 at 9:34 Comment(0)
P
0

as other people answered it was because of space in JAVA_HOME path and i had to replace Program Files with Progra~1. but i had to change it both in environment variables and in hadoop-env.cmd file. i fot the same error until i changed it in both places.

Passmore answered 27/7, 2020 at 9:8 Comment(0)
P
0

So Hadoop don't like spaces in any of its environmental variables. So my recommendation would be to explicitly set

  • JAVA_HOME
  • HADOOP_BIN_PATH
  • HADOOP_HOME

And use the C:\PROGRA~1\ syntax for all files paths, avoiding spaces.

Pneumothorax answered 2/7, 2021 at 12:26 Comment(0)
S
0

This is how my hadoop files look like for windows

I have uploaded my working etc/hadoop folder in github for windows 11

My environment path

JAVA_HOME = D:\Java\jdk1.8.0_202

HADOOP_HOME = d:\hadoop-3.3.1

HADOOP_BIN_PATH = d:\hadoop-3.3.1\bin

rest XML files and contents that needed to be modified can be found in my github repo

Hope this helps https://github.com/gptshubham595/hadoop-windows

Suburbanite answered 8/1, 2022 at 8:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.