You are seeing these compilation errors because some hadoop jars are absent in your classpath.

You need to add the required jars from HADOOP_HOME and HADOOP_HOME/lib in your class path.

Easier approach would be to build and pack your application jar in an IDE like eclipse , deploy the jar on your hadoop client machine and run it using 'hadoop jar ...' command.
Bejoy KS

Sent from handheld, please excuse typos.

From: R J <rj201244@yahoo.com>
Date: Wed, 14 Nov 2012 15:21:39 -0800 (PST)
To: Robert Evans<evans@yahoo-inc.com>; user@hadoop.apache.org<user@hadoop.apache.org>
ReplyTo: user@hadoop.apache.org
Subject: Re: Hadoop Java compilation error

Thanks a lot.

I studied and tried the WordCount.java program as in the URL http://hadoop.apache.org/docs/r0.20.2/mapred_tutorial.html

$ javac -version
javac 1.6.0
$javac -classpath /usr/local/hadoop-1.0.4/hadoop-core-1.0.4.jar:/usr/local/hadoop-1.0.4/lib/commons-cli-1.2.jar -d wordcount_classes WordCount.java

I get 48 compilation errors. The first few are like:
WordCount.java:6: package org.apache.hadoop.fs does not exist
        import org.apache.hadoop.fs.Path;
WordCount.java:7: package org.apache.hadoop.conf does not exist
        import org.apache.hadoop.conf.*;

It seems the javac compiler cannot locate the hadoop packages. Is there any other way to include the packages in the compilation command? Thank you.

From: Robert Evans <evans@yahoo-inc.com>
To: "user@hadoop.apache.org" <user@hadoop.apache.org>; R J <rj201244@yahoo.com>
Sent: Wednesday, November 14, 2012 3:36 PM
Subject: Re: Hadoop Java compilation error

Hadoop is not a java runtime environment it runs special map/reduce applications.  Go search for "how to write a hadoop program" and there will be lots of examples or you can pick up a book on Hadoop and that can help you with some examples too.


From: R J <rj201244@yahoo.com>
Reply-To: "user@hadoop.apache.org" <user@hadoop.apache.org>, R J <rj201244@yahoo.com>
Date: Wednesday, November 14, 2012 3:00 PM
To: "user@hadoop.apache.org" <user@hadoop.apache.org>
Subject: Hadoop Java compilation error

Hi All,
I installed Hadoop 1.0.4 on Cygwin and tried to run Java HelloWorld but I get exception error:
$ bin/hadoop javac HelloWorld.java
java.lang.NoClassDefFoundError: javac
Exception in thread "main"
$ echo $JAVA_HOME
$ javac HelloWorld.java
$ java HelloWorld
Hello, World
I have set JAVA_HOME environment variable in hadoop-env.sh .
How do I make it work on hadoop?
Thank you.