Hadoop Map/Reduce
  1. Hadoop Map/Reduce
  2. MAPREDUCE-806

WordCount example does not compile given the current instructions

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Trivial Trivial
    • Resolution: Unresolved
    • Affects Version/s: 0.20.1
    • Fix Version/s: None
    • Component/s: examples
    • Labels:
      None
    • Environment:

      linux

    • Tags:
      example wordcount

      Description

      http://hadoop.apache.org/common/docs/r0.20.0/mapred_tutorial.html#Example%3A+WordCount+v1.0

      In this example, the classpath is missing commons-cli-2.0-SNAPSHOT.jar

      If we compile according to the instructions:

      $ javac -classpath /hadoop/core/hadoop-0.20.0-core.jar -d ioperf_classes/ src/WordCount.java
      src/WordCount.java:54: cannot access org.apache.commons.cli.Options
      class file for org.apache.commons.cli.Options not found
      String[] otherArgs = new GenericOptionsParser(conf, args).getRemainingArgs();

      The correct compilation should be

      $ javac -classpath /hadoop/core/hadoop-0.20.0-core.jar:/hadoop/core/lib/commons-cli-2.0-SNAPSHOT.jar -d ioperf_classes/ src/WordCount.java

        Activity

        Hide
        Mamen added a comment -

        Hello
        I have this problem but with hadoop-0.21.0 version. On this version, how is the correct compilation? I search commons-cli-2.0-SNAPSHOT.jar in this version but don't exist.
        Thank you

        Show
        Mamen added a comment - Hello I have this problem but with hadoop-0.21.0 version. On this version, how is the correct compilation? I search commons-cli-2.0-SNAPSHOT.jar in this version but don't exist. Thank you
        Hide
        Muhammad Khojaye added a comment -

        I am having the same issue. There is no jar exist with the above name.

        Show
        Muhammad Khojaye added a comment - I am having the same issue. There is no jar exist with the above name.
        Hide
        Anastasis Andronidis added a comment -

        The file you are looking for in hadoop-0.21.0 is in HADOOP_HOME/lib/commons-cli-1.2.jar It is not ver 2.0 but worked for me.

        Show
        Anastasis Andronidis added a comment - The file you are looking for in hadoop-0.21.0 is in HADOOP_HOME/lib/commons-cli-1.2.jar It is not ver 2.0 but worked for me.
        Hide
        Abhay Bhangale added a comment -

        Thanks. That helped.
        $ pwd
        /home/abhay/sandbox/hadoop-0.20.203.0

        $ find * iname commons-cli*.jar
        lib/commons-cli-1.2.jar

        $ javac -cp hadoop-core-0.20.203.0.jar:lib/commons-cli-1.2.jar -d playground/classes playground/src/WordCount.java

        And it compiled fine!

        Show
        Abhay Bhangale added a comment - Thanks. That helped. $ pwd /home/abhay/sandbox/hadoop-0.20.203.0 $ find * iname commons-cli *.jar lib/commons-cli-1.2.jar $ javac -cp hadoop-core-0.20.203.0.jar:lib/commons-cli-1.2.jar -d playground/classes playground/src/WordCount.java And it compiled fine!
        Hide
        Karthik Kambatla added a comment -

        Can we mark this resolved?

        Show
        Karthik Kambatla added a comment - Can we mark this resolved?
        Hide
        sakurai added a comment -

        i came across here as i happened to be facing the same problem.
        everything goes well after i followed the instruction here(no errors after this), but i cant see any wordcount.jar created..

        javac -classpath /home/hadoop/hadoop/hadoop-core-1.0.3.jar:/home/hadoop/hadoop/lib/commons-cli-1.2.jar -d classes src/WordCount.java

        i only have the following classes created.
        rw-rw-r- 1 hadoop hadoop 1790 Aug 7 15:42 WordCount$TokenizerMapper.class
        rw-rw-r- 1 hadoop hadoop 1789 Aug 7 15:42 WordCount$IntSumReducer.class
        rw-rw-r- 1 hadoop hadoop 1911 Aug 7 15:42 WordCount.class

        sorry, i am not familiar with java, can someone tell me if my compiling is correct?

        thank you.

        Show
        sakurai added a comment - i came across here as i happened to be facing the same problem. everything goes well after i followed the instruction here(no errors after this), but i cant see any wordcount.jar created.. javac -classpath /home/hadoop/hadoop/hadoop-core-1.0.3.jar:/home/hadoop/hadoop/lib/commons-cli-1.2.jar -d classes src/WordCount.java i only have the following classes created. rw-rw-r - 1 hadoop hadoop 1790 Aug 7 15:42 WordCount$TokenizerMapper.class rw-rw-r - 1 hadoop hadoop 1789 Aug 7 15:42 WordCount$IntSumReducer.class rw-rw-r - 1 hadoop hadoop 1911 Aug 7 15:42 WordCount.class sorry, i am not familiar with java, can someone tell me if my compiling is correct? thank you.
        Hide
        sakurai added a comment -

        sorry, i missed out the jar command....

        Show
        sakurai added a comment - sorry, i missed out the jar command....

          People

          • Assignee:
            Unassigned
            Reporter:
            Hector Yuen
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:

              Development