hadoop-mapreduce-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Harsh J <ha...@cloudera.com>
Subject Re: Can not find hadoop packages
Date Thu, 29 May 2014 11:34:08 GMT
A homebrew user!

You can rely on the hadoop script to generate a usable runtime and
compile time classpath for you. So just do it as below (assuming
'hadoop' as a command is on your $PATH already):

$ javac -cp $(hadoop classpath) -d myClasses WordCount.java

On Thu, May 29, 2014 at 12:43 AM, Zhige Xin <xinzhige8@gmail.com> wrote:
> Hi deal all,
>
> I tried to compile my own WordCount.java using the following command:
>
> javac -classpath
> /usr/local/Cellar/hadoop/2.2.0/libexec/share/hadoop/common/hadoop-common-2.2.0:/usr/local/Cellar/hadoop/2.2.0/libexec/share/hadoop/mapreduce/hadoop-mapreduce-client-core-2.2.0.jar:/usr/local/Cellar/hadoop/2.2.0/libexec/share/hadoop/common/lib/commons-cli-1.2.jar
> -d myClasses WordCount.java
>
> but got some errors as follows:
>
> WordCount.java:1: error: package org.apache.hadoop.conf does not exist
>
> import org.apache.hadoop.conf.Configuration;
>
>                              ^
>
> WordCount.java:2: error: package org.apache.hadoop.fs does not exist
>
> import org.apache.hadoop.fs.Path;
>
>                            ^
>
> WordCount.java:3: error: package org.apache.hadoop.io does not exist
>
> import org.apache.hadoop.io.Text;
>
>                            ^
>
> WordCount.java:11: error: cannot find symbol
>
>         Configuration configuration = new Configuration();
>
>         ^
>
>   symbol:   class Configuration
>
>   location: class WordCount
>
> WordCount.java:11: error: cannot find symbol
>
>         Configuration configuration = new Configuration();
>
>                                           ^
>
>   symbol:   class Configuration
>
>   location: class WordCount
>
> WordCount.java:14: error: cannot access Configuration
>
>         Job job = new Job(configuration, "Word Count");
>
>                   ^
>
>   class file for org.apache.hadoop.conf.Configuration not found
>
> WordCount.java:16: error: cannot find symbol
>
>         job.setMapperClass(Map.class);
>
>                            ^
>
>   symbol:   class Map
>
>   location: class WordCount
>
> WordCount.java:17: error: cannot find symbol
>
>         job.setReducerClass(Reduce.class);
>
>                             ^
>
>   symbol:   class Reduce
>
>   location: class WordCount
>
> WordCount.java:18: error: cannot find symbol
>
>         job.setOutputKeyClass(Text.class);
>
>                               ^
>
>   symbol:   class Text
>
>   location: class WordCount
>
> WordCount.java:19: error: cannot find symbol
>
>         job.setOutputValueClass(Text.class);
>
>                                 ^
>
>   symbol:   class Text
>
>   location: class WordCount
>
> WordCount.java:22: error: cannot find symbol
>
>         FileInputFormat.addInputPath(job, new Path(args[0]));
>
>                                               ^
>
>   symbol:   class Path
>
>   location: class WordCount
>
> WordCount.java:23: error: cannot find symbol
>
>         FileOutputFormat.setOutputPath(job, new Path(args[1]));
>
>                                                 ^
>
>   symbol:   class Path
>
>   location: class WordCount
>
> Note: WordCount.java uses or overrides a deprecated API.
>
> Note: Recompile with -Xlint:deprecation for details.
>
> 12 errors
>
>
> I do not why because I checked this post
>
> http://ac31004.blogspot.com/2013/11/hadoop-2x-jar-file-location-for.html
>
> and added the jars (hadoop-common-2.2.0,
> hadoop-mapreduce-client-core-2.2.0.jar and commons-cli-1.2.jar) into my
> classpath but it still does not work.
>
> Thanks!
>
>
>
> Best,
>
> Isaiah



-- 
Harsh J

Mime
View raw message