<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: Cannot compile WordCount.java in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Cannot-compile-WordCount-java/m-p/236693#M198506</link>
    <description>&lt;P&gt;Thank you, indeed it worked with &lt;/P&gt;&lt;P&gt;javac -cp `hadoop classpath` -d wordcount_classes WordCount.java&lt;/P&gt;</description>
    <pubDate>Sun, 24 Mar 2019 19:19:46 GMT</pubDate>
    <dc:creator>wi16b087</dc:creator>
    <dc:date>2019-03-24T19:19:46Z</dc:date>
    <item>
      <title>Cannot compile WordCount.java</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Cannot-compile-WordCount-java/m-p/236691#M198504</link>
      <description>&lt;P&gt;Hi, I'm following Douglas Eadline's tutorial &lt;A href="http://www.informit.com/store/hadoop-and-spark-fundamentals-livelessons-9780134770864" target="_blank"&gt;http://www.informit.com/store/hadoop-and-spark-fundamentals-livelessons-9780134770864&lt;/A&gt;  and try to compile the WordCount example, but I fail. Eadline suggests to comile it with hadoop-core.jar, which was renamed in newer versions as I understand.&lt;/P&gt;&lt;P&gt;I tried with javac -classpath /usr/hdp/current/hadoop-mapreduce-client/hadoop-mapreduce-client-core.jar -d wordcount_classes WordCount.java but I still get a load of errors. Any suggestions? Where can I find the correct jar?&lt;/P&gt;&lt;P style="margin-left:20px"&gt;WordCount.java:27: error: package org.apache.hadoop.conf does not exist&lt;/P&gt;&lt;P style="margin-left:20px"&gt;import org.apache.hadoop.conf.Configuration;&lt;/P&gt;&lt;P style="margin-left:20px"&gt;                             ^&lt;/P&gt;&lt;P style="margin-left:20px"&gt;WordCount.java:28: error: package org.apache.hadoop.conf does not exist&lt;/P&gt;&lt;P style="margin-left:20px"&gt;import org.apache.hadoop.conf.Configured;&lt;/P&gt;&lt;P style="margin-left:20px"&gt;                             ^&lt;/P&gt;&lt;P style="margin-left:20px"&gt;WordCount.java:29: error: package org.apache.hadoop.fs does not exist&lt;/P&gt;&lt;P style="margin-left:20px"&gt;import org.apache.hadoop.fs.Path;&lt;/P&gt;&lt;P style="margin-left:20px"&gt;                           ^&lt;/P&gt;&lt;P style="margin-left:20px"&gt;WordCount.java:30: error: package org.apache.hadoop.io does not exist&lt;/P&gt;&lt;P style="margin-left:20px"&gt;import org.apache.hadoop.io.IntWritable;&lt;/P&gt;&lt;P style="margin-left:20px"&gt;                           ^&lt;/P&gt;&lt;P style="margin-left:20px"&gt;WordCount.java:31: error: package org.apache.hadoop.io does not exist&lt;/P&gt;&lt;P style="margin-left:20px"&gt;import org.apache.hadoop.io.LongWritable;&lt;/P&gt;&lt;P style="margin-left:20px"&gt;                           ^&lt;/P&gt;&lt;P style="margin-left:20px"&gt;WordCount.java:32: error: package org.apache.hadoop.io does not exist&lt;/P&gt;&lt;P style="margin-left:20px"&gt;import org.apache.hadoop.io.Text;&lt;/P&gt;&lt;P style="margin-left:20px"&gt;                           ^&lt;/P&gt;&lt;P style="margin-left:20px"&gt;WordCount.java:42: error: package org.apache.hadoop.util does not exist&lt;/P&gt;&lt;P style="margin-left:20px"&gt;import org.apache.hadoop.util.Tool;&lt;/P&gt;&lt;P style="margin-left:20px"&gt;                             ^&lt;/P&gt;&lt;P style="margin-left:20px"&gt;WordCount.java:43: error: package org.apache.hadoop.util does not exist&lt;/P&gt;&lt;P style="margin-left:20px"&gt;import org.apache.hadoop.util.ToolRunner;&lt;/P&gt;&lt;P style="margin-left:20px"&gt;                             ^&lt;/P&gt;&lt;P style="margin-left:20px"&gt;WordCount.java:54: error: cannot find symbol&lt;/P&gt;&lt;P style="margin-left:20px"&gt;public class WordCount extends Configured implements Tool {&lt;!-- --&gt;&lt;/P&gt;&lt;P style="margin-left:20px"&gt;                               ^&lt;/P&gt;&lt;P style="margin-left:20px"&gt;  symbol: class Configured&lt;/P&gt;&lt;P style="margin-left:20px"&gt;WordCount.java:54: error: cannot find symbol&lt;/P&gt;&lt;P style="margin-left:20px"&gt;public class WordCount extends Configured implements Tool {&lt;!-- --&gt;&lt;/P&gt;&lt;P style="margin-left:20px"&gt;                                                     ^&lt;/P&gt;&lt;P style="margin-left:20px"&gt;  symbol: class Tool&lt;/P&gt;&lt;P style="margin-left:20px"&gt;WordCount.java:61: error: cannot access Closeable&lt;/P&gt;&lt;P style="margin-left:20px"&gt;  public static class MapClass extends MapReduceBase&lt;/P&gt;&lt;P style="margin-left:20px"&gt;                ^&lt;/P&gt;&lt;P style="margin-left:20px"&gt;  class file for org.apache.hadoop.io.Closeable not found&lt;/P&gt;&lt;P style="margin-left:20px"&gt;WordCount.java:64: error: cannot find symbol&lt;/P&gt;&lt;P style="margin-left:20px"&gt;    private final static IntWritable one = new IntWritable(1);&lt;/P&gt;&lt;P style="margin-left:20px"&gt;                         ^&lt;/P&gt;&lt;P style="margin-left:20px"&gt;  symbol:   class IntWritable&lt;/P&gt;&lt;P style="margin-left:20px"&gt;  location: class MapClass&lt;/P&gt;&lt;P style="margin-left:20px"&gt;WordCount.java:65: error: cannot find symbol&lt;/P&gt;&lt;P style="margin-left:20px"&gt;    private Text word = new Text();&lt;/P&gt;&lt;P style="margin-left:20px"&gt;            ^&lt;/P&gt;&lt;P style="margin-left:20px"&gt;  symbol:   class Text&lt;/P&gt;&lt;P style="margin-left:20px"&gt;  location: class MapClass&lt;/P&gt;&lt;P style="margin-left:20px"&gt;WordCount.java:67: error: cannot find symbol&lt;/P&gt;&lt;P style="margin-left:20px"&gt;    public void map(LongWritable key, Text value,&lt;/P&gt;&lt;P style="margin-left:20px"&gt;                    ^&lt;/P&gt;&lt;P style="margin-left:20px"&gt;  symbol:   class LongWritable&lt;/P&gt;&lt;P style="margin-left:20px"&gt;  location: class MapClass&lt;/P&gt;&lt;P style="margin-left:20px"&gt;WordCount.java:67: error: cannot find symbol&lt;/P&gt;&lt;P style="margin-left:20px"&gt;    public void map(LongWritable key, Text value,&lt;/P&gt;&lt;P style="margin-left:20px"&gt;                                      ^&lt;/P&gt;&lt;P style="margin-left:20px"&gt;  symbol:   class Text&lt;/P&gt;&lt;P style="margin-left:20px"&gt;  location: class MapClass&lt;/P&gt;&lt;P style="margin-left:20px"&gt;WordCount.java:68: error: cannot find symbol&lt;/P&gt;&lt;P style="margin-left:20px"&gt;                    OutputCollector&amp;lt;Text, IntWritable&amp;gt; output,&lt;/P&gt;&lt;P style="margin-left:20px"&gt;                                    ^&lt;/P&gt;&lt;P style="margin-left:20px"&gt;  symbol:   class Text&lt;/P&gt;&lt;P style="margin-left:20px"&gt;  location: class MapClass&lt;/P&gt;&lt;P style="margin-left:20px"&gt;WordCount.java:68: error: cannot find symbol&lt;/P&gt;&lt;P style="margin-left:20px"&gt;                    OutputCollector&amp;lt;Text, IntWritable&amp;gt; output,&lt;/P&gt;&lt;P style="margin-left:20px"&gt;                                          ^&lt;/P&gt;&lt;P style="margin-left:20px"&gt;  symbol:   class IntWritable&lt;/P&gt;&lt;P style="margin-left:20px"&gt;  location: class MapClass&lt;/P&gt;&lt;P style="margin-left:20px"&gt;WordCount.java:83: error: cannot find symbol&lt;/P&gt;&lt;P style="margin-left:20px"&gt;    implements Reducer&amp;lt;Text, IntWritable, Text, IntWritable&amp;gt; {&lt;!-- --&gt;&lt;/P&gt;&lt;P style="margin-left:20px"&gt;                       ^&lt;/P&gt;&lt;P style="margin-left:20px"&gt;  symbol:   class Text&lt;/P&gt;&lt;P style="margin-left:20px"&gt;  location: class WordCount&lt;/P&gt;&lt;P style="margin-left:20px"&gt;WordCount.java:83: error: cannot find symbol&lt;/P&gt;&lt;P style="margin-left:20px"&gt;    implements Reducer&amp;lt;Text, IntWritable, Text, IntWritable&amp;gt; {&lt;!-- --&gt;&lt;/P&gt;&lt;P style="margin-left:20px"&gt;                             ^&lt;/P&gt;&lt;P style="margin-left:20px"&gt;  symbol:   class IntWritable&lt;/P&gt;&lt;P style="margin-left:20px"&gt;  location: class WordCount&lt;/P&gt;&lt;P style="margin-left:20px"&gt;WordCount.java:83: error: cannot find symbol&lt;/P&gt;&lt;P style="margin-left:20px"&gt;    implements Reducer&amp;lt;Text, IntWritable, Text, IntWritable&amp;gt; {&lt;!-- --&gt;&lt;/P&gt;&lt;P style="margin-left:20px"&gt;                                          ^&lt;/P&gt;&lt;P style="margin-left:20px"&gt;  symbol:   class Text&lt;/P&gt;&lt;P style="margin-left:20px"&gt;  location: class WordCount&lt;/P&gt;&lt;P style="margin-left:20px"&gt;WordCount.java:83: error: cannot find symbol&lt;/P&gt;&lt;P style="margin-left:20px"&gt;    implements Reducer&amp;lt;Text, IntWritable, Text, IntWritable&amp;gt; {&lt;!-- --&gt;&lt;/P&gt;&lt;P style="margin-left:20px"&gt;                                                ^&lt;/P&gt;&lt;P style="margin-left:20px"&gt;  symbol:   class IntWritable&lt;/P&gt;&lt;P style="margin-left:20px"&gt;  location: class WordCount&lt;/P&gt;&lt;P style="margin-left:20px"&gt;WordCount.java:85: error: cannot find symbol&lt;/P&gt;&lt;P style="margin-left:20px"&gt;    public void reduce(Text key, Iterator&amp;lt;IntWritable&amp;gt; values,&lt;/P&gt;&lt;P style="margin-left:20px"&gt;                       ^&lt;/P&gt;&lt;P style="margin-left:20px"&gt;  symbol:   class Text&lt;/P&gt;&lt;P style="margin-left:20px"&gt;  location: class Reduce&lt;/P&gt;&lt;P style="margin-left:20px"&gt;WordCount.java:85: error: cannot find symbol&lt;/P&gt;&lt;P style="margin-left:20px"&gt;    public void reduce(Text key, Iterator&amp;lt;IntWritable&amp;gt; values,&lt;/P&gt;&lt;P style="margin-left:20px"&gt;                                          ^&lt;/P&gt;&lt;P style="margin-left:20px"&gt;  symbol:   class IntWritable&lt;/P&gt;&lt;P style="margin-left:20px"&gt;  location: class Reduce&lt;/P&gt;&lt;P style="margin-left:20px"&gt;WordCount.java:86: error: cannot find symbol&lt;/P&gt;&lt;P style="margin-left:20px"&gt;                       OutputCollector&amp;lt;Text, IntWritable&amp;gt; output,&lt;/P&gt;&lt;P style="margin-left:20px"&gt;                                       ^&lt;/P&gt;&lt;P style="margin-left:20px"&gt;  symbol:   class Text&lt;/P&gt;&lt;P style="margin-left:20px"&gt;  location: class Reduce&lt;/P&gt;&lt;P style="margin-left:20px"&gt;WordCount.java:86: error: cannot find symbol&lt;/P&gt;&lt;P style="margin-left:20px"&gt;                       OutputCollector&amp;lt;Text, IntWritable&amp;gt; output,&lt;/P&gt;&lt;P style="margin-left:20px"&gt;                                             ^&lt;/P&gt;&lt;P style="margin-left:20px"&gt;  symbol:   class IntWritable&lt;/P&gt;&lt;P style="margin-left:20px"&gt;  location: class Reduce&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 14:14:54 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Cannot-compile-WordCount-java/m-p/236691#M198504</guid>
      <dc:creator>wi16b087</dc:creator>
      <dc:date>2022-09-16T14:14:54Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot compile WordCount.java</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Cannot-compile-WordCount-java/m-p/236692#M198505</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/112427/wi16b087.html"&gt;@Alessandro Volcich&lt;/A&gt;&lt;/P&gt;&lt;P&gt;The hadoop command line utility also provides an option to get the correct classpath produced something like following which you can use:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Example:&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;# export&amp;nbsp;CLASSPATH=`hadoop&amp;nbsp;classpath`:.:

# echo $CLASSPATH
# javac -d wordcount_classes WordCount.java&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 24 Mar 2019 02:54:48 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Cannot-compile-WordCount-java/m-p/236692#M198505</guid>
      <dc:creator>jsensharma</dc:creator>
      <dc:date>2019-03-24T02:54:48Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot compile WordCount.java</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Cannot-compile-WordCount-java/m-p/236693#M198506</link>
      <description>&lt;P&gt;Thank you, indeed it worked with &lt;/P&gt;&lt;P&gt;javac -cp `hadoop classpath` -d wordcount_classes WordCount.java&lt;/P&gt;</description>
      <pubDate>Sun, 24 Mar 2019 19:19:46 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Cannot-compile-WordCount-java/m-p/236693#M198506</guid>
      <dc:creator>wi16b087</dc:creator>
      <dc:date>2019-03-24T19:19:46Z</dc:date>
    </item>
  </channel>
</rss>

