Note that there are some explanatory texts on larger screens.

plurals
  1. POShowing error while running WordCount.java
    primarykey
    data
    text
    <p>I tried this code: </p> <pre><code>javac -verbose -classpath /var/root/hadoop-1.0.4/hadoop-1.0.4-core.jar WordCount.java -d /Users/amrita/desktop/hadoop/javatrail/wordcount_classes </code></pre> <p>I just get the following error:</p> <pre><code>parsing started WordCount.java] [parsing completed 12ms] [search path for source files: /var/root/hadoop-1.0.4/hadoop-1.0.4-core.jar] [search path for class files: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/jsfd.jar,/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/classes.jar,/System/Library/Frameworks/JavaVM.framework/Frameworks/JavaRuntimeSupport.framework/Resources/Java/JavaRuntimeSupport.jar,/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/ui.jar,/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/laf.jar,/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/sunrsasign.jar,/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/jsse.jar,/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/jce.jar,/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/charsets.jar,/Library/Java/Extensions/RXTXcomm.jar,/System/Library/Java/Extensions/AppleScriptEngine.jar,/System/Library/Java/Extensions/dns_sd.jar,/System/Library/Java/Extensions/j3daudio.jar,/System/Library/Java/Extensions/j3dcore.jar,/System/Library/Java/Extensions/j3dutils.jar,/System/Library/Java/Extensions/jai_codec.jar,/System/Library/Java/Extensions/jai_core.jar,/System/Library/Java/Extensions/mlibwrapper_jai.jar,/System/Library/Java/Extensions/MRJToolkit.jar,/System/Library/Java/Extensions/QTJava.zip,/System/Library/Java/Extensions/vecmath.jar,/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext/apple_provider.jar,/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext/dnsns.jar,/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext/localedata.jar,/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext/sunjce_provider.jar,/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext/sunpkcs11.jar,/var/root/hadoop-1.0.4/hadoop-1.0.4-core.jar] [loading java/io/IOException.class(java/io:IOException.class)] WordCount.java:5: package org.apache.hadoop.fs does not exist import org.apache.hadoop.fs.Path; ^ WordCount.java:6: package org.apache.hadoop.conf does not exist import org.apache.hadoop.conf.*; ^ WordCount.java:7: package org.apache.hadoop.io does not exist import org.apache.hadoop.io.*; ^ WordCount.java:8: package org.apache.hadoop.mapred does not exist import org.apache.hadoop.mapred.*; ^ WordCount.java:9: package org.apache.hadoop.util does not exist import org.apache.hadoop.util.*; ^ [loading java/lang/Object.class(java/lang:Object.class)] [loading java/lang/String.class(java/lang:String.class)] [loading java/lang/Exception.class(java/lang:Exception.class)] WordCount.java:11: cannot find symbol symbol : class MapReduceBase location: class org.myorg.WordCount public static class Map extends MapReduceBase implements Mapper&lt;LongWritable, Text, Text, IntWritable&gt; { ^ WordCount.java:11: cannot find symbol symbol : class Mapper location: class org.myorg.WordCount public static class Map extends MapReduceBase implements Mapper&lt;LongWritable, Text, Text, IntWritable&gt; { ^ WordCount.java:11: cannot find symbol symbol : class LongWritable location: class org.myorg.WordCount public static class Map extends MapReduceBase implements Mapper&lt;LongWritable, Text, Text, IntWritable&gt; { ^ [total 406ms] 48 errors </code></pre> <p>Is there any problem in my classpath? If so, how can I get the correct class path? My WordCount.java is in /Users/amrita/.... and hadoop in root, is there any privilege issue? I am not able to generate WordCount.class</p> <p>source code: WordCount.java</p> <pre><code>package org.myorg; import java.io.IOException; import java.util.*; import org.apache.hadoop.fs.Path; import org.apache.hadoop.conf.*; import org.apache.hadoop.io.*; import org.apache.hadoop.mapred.*; import org.apache.hadoop.util.*; public class WordCount { public static class Map extends MapReduceBase implements Mapper&lt;LongWritable, Text, Text, IntWritable&gt; { private final static IntWritable one = new IntWritable(1); private Text word = new Text(); public void map(LongWritable key, Text value, OutputCollector&lt;Text, IntWritable&gt; output, Reporter reporter) throws IOException { String line = value.toString(); StringTokenizer tokenizer = new StringTokenizer(line); while (tokenizer.hasMoreTokens()) { word.set(tokenizer.nextToken()); output.collect(word, one); } } } public static class Reduce extends MapReduceBase implements Reducer&lt;Text, IntWritable, Text, IntWritable&gt; { public void reduce(Text key, Iterator&lt;IntWritable&gt; values, OutputCollector&lt;Text, IntWritable&gt; output, Reporter reporter) throws IOException { int sum = 0; while (values.hasNext()) { sum += values.next().get(); } output.collect(key, new IntWritable(sum)); } } public static void main(String[] args) throws Exception { JobConf conf = new JobConf(WordCount.class); conf.setJobName("wordcount"); conf.setOutputKeyClass(Text.class); conf.setOutputValueClass(IntWritable.class); conf.setMapperClass(Map.class); conf.setCombinerClass(Reduce.class); conf.setReducerClass(Reduce.class); conf.setInputFormat(TextInputFormat.class); conf.setOutputFormat(TextOutputFormat.class); FileInputFormat.setInputPaths(conf, new Path(args[0])); FileOutputFormat.setOutputPath(conf, new Path(args[1])); JobClient.runJob(conf); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload