Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 Search Hadoop and all its subprojects:

Switch to Threaded View
MapReduce >> mail # user >> Hadoop Java compilation error


Copy link to this message
-
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 <[EMAIL PROTECTED]>
To: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>; R J <[EMAIL PROTECTED]>
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.

--Bobby
From:  R J <[EMAIL PROTECTED]>
Reply-To:  "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>, R J <[EMAIL PROTECTED]>
Date:  Wednesday, November 14, 2012 3:00 PM
To:  "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
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
/cygdrive/c/java
$ 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.
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB