hadoop - How to make WordCount use new Java libraries in Cloudera? -


i new hadoop, , trying example of wordcount v1.0 here:

https://www.cloudera.com/documentation/other/tutorial/cdh5/topics/ht_usage.html

however, when compile wordcount.java using line:

javac -cp /usr/lib/hadoop/*:/usr/lib/hadoop-mapreduce/* wordcount.java -d build -xlint 

it seems code uses old version of .jar files, , gives me following warnings (as shown in picture). however, when check inside classpath declared, there .jar files seems newer versions of being required .jar files. enter image description here

so question how can make wordcount.java use newer file instead? tried looking inside wordcount.java code see rows use required .jar files not see them. in advance help.

the code of wordcount.java

import java.io.ioexception; import java.util.stringtokenizer;  import org.apache.hadoop.conf.configuration; import org.apache.hadoop.fs.path; import org.apache.hadoop.io.intwritable; import org.apache.hadoop.io.text; import org.apache.hadoop.mapreduce.job; import org.apache.hadoop.mapreduce.mapper; import org.apache.hadoop.mapreduce.reducer; import org.apache.hadoop.mapreduce.lib.input.fileinputformat; import org.apache.hadoop.mapreduce.lib.output.fileoutputformat;  public class wordcount {    public static class tokenizermapper        extends mapper<object, text, text, intwritable>{      private final static intwritable 1 = new intwritable(1);     private text word = new text();      public void map(object key, text value, context context                     ) throws ioexception, interruptedexception {       stringtokenizer itr = new stringtokenizer(value.tostring());       while (itr.hasmoretokens()) {         word.set(itr.nexttoken());         context.write(word, one);       }     }   }    public static class intsumreducer        extends reducer<text,intwritable,text,intwritable> {     private intwritable result = new intwritable();      public void reduce(text key, iterable<intwritable> values,                        context context                        ) throws ioexception, interruptedexception {       int sum = 0;       (intwritable val : values) {         sum += val.get();       }       result.set(sum);       context.write(key, result);     }   }    public static void main(string[] args) throws exception {     configuration conf = new configuration();     job job = job.getinstance(conf, "word count");     job.setjarbyclass(wordcount.class);     job.setmapperclass(tokenizermapper.class);     job.setcombinerclass(intsumreducer.class);     job.setreducerclass(intsumreducer.class);     job.setoutputkeyclass(text.class);     job.setoutputvalueclass(intwritable.class);     fileinputformat.addinputpath(job, new path(args[0]));     fileoutputformat.setoutputpath(job, new path(args[1]));     system.exit(job.waitforcompletion(true) ? 0 : 1);   } } 


Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -