Hi Mikhail,

Thanks a lot for your clear response.

--Prateek.

On Sat, Feb 6, 2010 at 4:06 PM, Mikhail Yakshin <greycat.na....@gmail.com>wrote:

> Hi,
>
> > 1) I have 3 files, namely MaxTemperature.java, MaxTemperatureMapper.java,
> > MaxTemperatureReducer.java. Now, I have to compile them to get the
> '.class'
> > files which would be used by 'hadoop' command. I tried the following:
> >
> > 'javac -cp .:/hadoop/lib MaxTemperatureMapper.java'
> >
> > But it gives me the error that it doesn't recognize the packages '
> > org.apache.hadoop.io', 'org.apache.hadoop.mapred' and so on.
> >
> > Can someone suggest something about that?
>
> Well, for a start, adding "/hadoop/lib" to your classpath is:
>
> 1) Literally, yeah, "/hadoop/lib", which means that if will try to
> find /hadoop in the root of your filesystem, then it will try to find
> "lib" in it. If you meant "hadoop" subdirectory in your current
> directory, use "hadoop/lib", not "/hadoop/lib".
>
> 2) You have to add individual jars in classpath, i.e.
> "hadoop/lib/hadoop-0.18.3-core.jar:hadoop/lib/hadoop-0.18.3-test.jar:...",
> etc. In recent versions of JDK, you can also specify "hadoop/lib/*",
> but make sure you add quotes on this or escape "*" somehow, so it
> won't get expanded with your shell.
>
> > 2) Also, do we have to make the '.class' files by ourselves necessarily.
> Or
> > is it somehow possible that hadoop will make .class files by itself (from
> > the .java source files)?
>
> Nope, Hadoop is not a Java compiler. Moreover, it's generally
> insufficient to just create .class files - Hadoop generally operates
> with .class files packed in .jar archives, which is a standard way of
> software distribution for Java.
>
> Running compilers, packers, etc, by hand is barely a good idea.
> Consider using "ant" for building or using an IDE, such as Eclipse,
> NetBeans or IDEA.
>
> --
> WBR, Mikhail Yakshin
>

Reply via email to