2

I have installed hadoop-2.4.0 in my 14.04 LTS,

I have followed this link, I have done upto start and stop services successfully,

but when I tried to execute example,

$ /bin/hadoop jar hadoop*examples*.jar wordcount /user/hduser/gutenberg /user/hduser/gutenberg-output

and I am getting response as,

Not a valid JAR: /hadoop*examples*.jar

EDIT 1

I have installed JAVA 7(i.e JDK 1.7) and when I used Hadoop-1.0.3 it works fine.

Problem cause when I try to execute with Hadoop-2.4.0.


NOTE

From this tutorial my system differ the following,

  1. I am using JAVA 7 instead of JAVA 6.
  2. I am using Hadoop 2.4.0 instead of Hadoop-1.0.3
  3. I am usinh Ubuntu 14.04 instead of Ubuntu 10.04.

And I can successfully execute HAdoop-1.0.3 with JAVA 7 on 14.04.

My question why can't I run the same for Hadoop-2.4.0.

1

I had the same problem. Here is the solution.

OS - Ubuntu 14.04 64-bit
Java - OpenJDK 7
Hadoop - Hadoop 2.4.1

Step 1: create a hdfs directory for input: hadoop dfs -mkdir -p /usr/local/hadoop/input

Step 2: now paste the jar file into this folder using hadoop command.

hadoop dfs -copyFromLocal /home/hduser/Desktop/sample.txt /usr/local/hadoop/input

Step 3: Go to $HADOOP_HOME/share/hadoop/mapreduce folder in terminal.

cd $HADOOP_HOME/share/hadoop/mapreduce

hadoop jar hadoop-mapreduce-examples-2.4.1.jar wordcount /usr/local/hadoop/input/sample.txt /usr/local/hadoop/output

Here /usr/local/hadoop/output folder will be created. Each time you have to give a new name.
NOTE: you cannot simply list the folders input and output using ls in terminal.

Step 4: To view the output, use this:

hadoop dfs -cat /usr/local/hadoop/output/part-r-00000

|improve this answer|||||
  • I followed this only, I got error when i run example... – A J Sep 1 '14 at 7:09
  • @ARUL, instead of using hadoop*examples*.jar , you need to use this jar hadoop-mapreduce-examples-2.4.1.jar in the folder $HADOOP_HOME/share/hadoop/mapreduce. You are getting the error because you are not specifying the path for jar. So navigate to the folder using cd $HADOOP_HOME/share/hadoop/mapreduce and then run the jar. It works fine. – kishorer747 Sep 26 '14 at 7:49
1

I was also following the same tutorial and faced same issue with my latest install (hadoop 2.7.1). I had to change it from

$ /bin/hadoop jar hadoop*examples*.jar wordcount /user/hduser/gutenberg /user/hduser/gutenberg-output

to

$ /bin/hadoop jar ./share/hadoop/mapreduce/hadoop-*-examples*.jar  wordcount /user/hduser/gutenberg /user/hduser/gutenberg-output
|improve this answer|||||
0

This tutorial has been tested with the following software versions:

Ubuntu Linux 10.04 LTS (deprecated: 8.10 LTS, 8.04, 7.10, 7.04)

It hasn't been updated since 10.04 ~ 2012. That is (I would guess your problem).

14.04 and 10.04 work quite differently...

Sun Java 6

Sun Java is no longer avaliable in Ubuntu so that is also probably why it isn't working.

|improve this answer|||||
  • I didn't followed exactly the same as tutorial said, I am using Oracle Java(JDK 1.7) and I am using Hadoop 2.4.0, actually my problem isn't that.. I can do with Hadoop 1.0.3 sucessfully.. When I do with Hadoop 2.4.0 am getting this problem... – A J Jul 31 '14 at 12:15
  • I have update my question, please take a look @Tim – A J Jul 31 '14 at 12:24
  • Does this work? codesfusion.blogspot.co.uk/2013/10/… – Tim Jul 31 '14 at 14:37
-1

I am using the hadoop-2.7.2 and to handle this problem, simply go to the directory hadoop-2.7.2 and instead of writing directly hadop*exaples*jar write the following:

share/hadoop/mapreduce/hadoop-mapreduce-examples-2.7.2.jar
|improve this answer|||||
  • Welcome to Ask Ubuntu! I recommend editing this answer to expand it with specific details about what to edit and how. (See also How do I write a good answer? for general advice about what sorts of answers are considered most valuable on Ask Ubuntu.) – David Foerster Jul 31 '16 at 14:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for?Browse other questions tagged or ask your own question.