You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hadoop.apache.org by R J <rj...@yahoo.com> on 2012/11/14 22:00:11 UTC

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.

Re: Hadoop Java compilation error

Posted by Bejoy KS <be...@gmail.com>.
Hi

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.

Regards
Bejoy KS

Sent from handheld, please excuse typos.

-----Original Message-----
From: R J <rj...@yahoo.com>
Date: Wed, 14 Nov 2012 15:21:39 
To: Robert Evans<ev...@yahoo-inc.com>; user@hadoop.apache.org<us...@hadoop.apache.org>
Reply-To: 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 <ev...@yahoo-inc.com>
To: "user@hadoop.apache.org" <us...@hadoop.apache.org>; R J <rj...@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.

--Bobby
From:  R J <rj...@yahoo.com>
Reply-To:  "user@hadoop.apache.org" <us...@hadoop.apache.org>, R J <rj...@yahoo.com>
Date:  Wednesday, November 14, 2012 3:00 PM
To:  "user@hadoop.apache.org" <us...@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
/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.

Re: Hadoop Java compilation error

Posted by Bejoy KS <be...@gmail.com>.
Hi

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.

Regards
Bejoy KS

Sent from handheld, please excuse typos.

-----Original Message-----
From: R J <rj...@yahoo.com>
Date: Wed, 14 Nov 2012 15:21:39 
To: Robert Evans<ev...@yahoo-inc.com>; user@hadoop.apache.org<us...@hadoop.apache.org>
Reply-To: 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 <ev...@yahoo-inc.com>
To: "user@hadoop.apache.org" <us...@hadoop.apache.org>; R J <rj...@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.

--Bobby
From:  R J <rj...@yahoo.com>
Reply-To:  "user@hadoop.apache.org" <us...@hadoop.apache.org>, R J <rj...@yahoo.com>
Date:  Wednesday, November 14, 2012 3:00 PM
To:  "user@hadoop.apache.org" <us...@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
/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.

Re: Hadoop Java compilation error

Posted by Bejoy KS <be...@gmail.com>.
Hi

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.

Regards
Bejoy KS

Sent from handheld, please excuse typos.

-----Original Message-----
From: R J <rj...@yahoo.com>
Date: Wed, 14 Nov 2012 15:21:39 
To: Robert Evans<ev...@yahoo-inc.com>; user@hadoop.apache.org<us...@hadoop.apache.org>
Reply-To: 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 <ev...@yahoo-inc.com>
To: "user@hadoop.apache.org" <us...@hadoop.apache.org>; R J <rj...@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.

--Bobby
From:  R J <rj...@yahoo.com>
Reply-To:  "user@hadoop.apache.org" <us...@hadoop.apache.org>, R J <rj...@yahoo.com>
Date:  Wednesday, November 14, 2012 3:00 PM
To:  "user@hadoop.apache.org" <us...@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
/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.

Re: Hadoop Java compilation error

Posted by Bejoy KS <be...@gmail.com>.
Hi

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.

Regards
Bejoy KS

Sent from handheld, please excuse typos.

-----Original Message-----
From: R J <rj...@yahoo.com>
Date: Wed, 14 Nov 2012 15:21:39 
To: Robert Evans<ev...@yahoo-inc.com>; user@hadoop.apache.org<us...@hadoop.apache.org>
Reply-To: 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 <ev...@yahoo-inc.com>
To: "user@hadoop.apache.org" <us...@hadoop.apache.org>; R J <rj...@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.

--Bobby
From:  R J <rj...@yahoo.com>
Reply-To:  "user@hadoop.apache.org" <us...@hadoop.apache.org>, R J <rj...@yahoo.com>
Date:  Wednesday, November 14, 2012 3:00 PM
To:  "user@hadoop.apache.org" <us...@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
/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.

Re: Hadoop Java compilation error

Posted by R J <rj...@yahoo.com>.
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 <ev...@yahoo-inc.com>
To: "user@hadoop.apache.org" <us...@hadoop.apache.org>; R J <rj...@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.

--Bobby
From:  R J <rj...@yahoo.com>
Reply-To:  "user@hadoop.apache.org" <us...@hadoop.apache.org>, R J <rj...@yahoo.com>
Date:  Wednesday, November 14, 2012 3:00 PM
To:  "user@hadoop.apache.org" <us...@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
/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.

Re: Hadoop Java compilation error

Posted by R J <rj...@yahoo.com>.
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 <ev...@yahoo-inc.com>
To: "user@hadoop.apache.org" <us...@hadoop.apache.org>; R J <rj...@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.

--Bobby
From:  R J <rj...@yahoo.com>
Reply-To:  "user@hadoop.apache.org" <us...@hadoop.apache.org>, R J <rj...@yahoo.com>
Date:  Wednesday, November 14, 2012 3:00 PM
To:  "user@hadoop.apache.org" <us...@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
/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.

RE: Hadoop Java compilation error

Posted by "Kartashov, Andy" <An...@mpac.ca>.
In order to run Hadoop program you will need it run it as follows:

$hadoop jar <jar-name>.jar <class-name>

Where:
class-name is comiled .class file with main() method
name-jar is a jar containing .class files

Compile your HelloWorld.java into HelloWorld.class. Create a jar file from HelloWorld.class and call it , say HW.jar

Then execute the program as follows:
$hadoop jar HW.jar HelloWorld

Happy Hadooping,
AK7

From: Robert Evans [mailto:evans@yahoo-inc.com]
Sent: Wednesday, November 14, 2012 4:37 PM
To: user@hadoop.apache.org; R J
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 <rj...@yahoo.com>>
Reply-To: "user@hadoop.apache.org<ma...@hadoop.apache.org>" <us...@hadoop.apache.org>>, R J <rj...@yahoo.com>>
Date: Wednesday, November 14, 2012 3:00 PM
To: "user@hadoop.apache.org<ma...@hadoop.apache.org>" <us...@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
/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.
NOTICE: This e-mail message and any attachments are confidential, subject to copyright and may be privileged. Any unauthorized use, copying or disclosure is prohibited. If you are not the intended recipient, please delete and contact the sender immediately. Please consider the environment before printing this e-mail. AVIS : le pr?sent courriel et toute pi?ce jointe qui l'accompagne sont confidentiels, prot?g?s par le droit d'auteur et peuvent ?tre couverts par le secret professionnel. Toute utilisation, copie ou divulgation non autoris?e est interdite. Si vous n'?tes pas le destinataire pr?vu de ce courriel, supprimez-le et contactez imm?diatement l'exp?diteur. Veuillez penser ? l'environnement avant d'imprimer le pr?sent courriel

Re: Hadoop Java compilation error

Posted by R J <rj...@yahoo.com>.
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 <ev...@yahoo-inc.com>
To: "user@hadoop.apache.org" <us...@hadoop.apache.org>; R J <rj...@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.

--Bobby
From:  R J <rj...@yahoo.com>
Reply-To:  "user@hadoop.apache.org" <us...@hadoop.apache.org>, R J <rj...@yahoo.com>
Date:  Wednesday, November 14, 2012 3:00 PM
To:  "user@hadoop.apache.org" <us...@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
/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.

Re: Hadoop Java compilation error

Posted by R J <rj...@yahoo.com>.
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 <ev...@yahoo-inc.com>
To: "user@hadoop.apache.org" <us...@hadoop.apache.org>; R J <rj...@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.

--Bobby
From:  R J <rj...@yahoo.com>
Reply-To:  "user@hadoop.apache.org" <us...@hadoop.apache.org>, R J <rj...@yahoo.com>
Date:  Wednesday, November 14, 2012 3:00 PM
To:  "user@hadoop.apache.org" <us...@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
/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.

RE: Hadoop Java compilation error

Posted by "Kartashov, Andy" <An...@mpac.ca>.
In order to run Hadoop program you will need it run it as follows:

$hadoop jar <jar-name>.jar <class-name>

Where:
class-name is comiled .class file with main() method
name-jar is a jar containing .class files

Compile your HelloWorld.java into HelloWorld.class. Create a jar file from HelloWorld.class and call it , say HW.jar

Then execute the program as follows:
$hadoop jar HW.jar HelloWorld

Happy Hadooping,
AK7

From: Robert Evans [mailto:evans@yahoo-inc.com]
Sent: Wednesday, November 14, 2012 4:37 PM
To: user@hadoop.apache.org; R J
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 <rj...@yahoo.com>>
Reply-To: "user@hadoop.apache.org<ma...@hadoop.apache.org>" <us...@hadoop.apache.org>>, R J <rj...@yahoo.com>>
Date: Wednesday, November 14, 2012 3:00 PM
To: "user@hadoop.apache.org<ma...@hadoop.apache.org>" <us...@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
/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.
NOTICE: This e-mail message and any attachments are confidential, subject to copyright and may be privileged. Any unauthorized use, copying or disclosure is prohibited. If you are not the intended recipient, please delete and contact the sender immediately. Please consider the environment before printing this e-mail. AVIS : le pr?sent courriel et toute pi?ce jointe qui l'accompagne sont confidentiels, prot?g?s par le droit d'auteur et peuvent ?tre couverts par le secret professionnel. Toute utilisation, copie ou divulgation non autoris?e est interdite. Si vous n'?tes pas le destinataire pr?vu de ce courriel, supprimez-le et contactez imm?diatement l'exp?diteur. Veuillez penser ? l'environnement avant d'imprimer le pr?sent courriel

RE: Hadoop Java compilation error

Posted by "Kartashov, Andy" <An...@mpac.ca>.
In order to run Hadoop program you will need it run it as follows:

$hadoop jar <jar-name>.jar <class-name>

Where:
class-name is comiled .class file with main() method
name-jar is a jar containing .class files

Compile your HelloWorld.java into HelloWorld.class. Create a jar file from HelloWorld.class and call it , say HW.jar

Then execute the program as follows:
$hadoop jar HW.jar HelloWorld

Happy Hadooping,
AK7

From: Robert Evans [mailto:evans@yahoo-inc.com]
Sent: Wednesday, November 14, 2012 4:37 PM
To: user@hadoop.apache.org; R J
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 <rj...@yahoo.com>>
Reply-To: "user@hadoop.apache.org<ma...@hadoop.apache.org>" <us...@hadoop.apache.org>>, R J <rj...@yahoo.com>>
Date: Wednesday, November 14, 2012 3:00 PM
To: "user@hadoop.apache.org<ma...@hadoop.apache.org>" <us...@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
/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.
NOTICE: This e-mail message and any attachments are confidential, subject to copyright and may be privileged. Any unauthorized use, copying or disclosure is prohibited. If you are not the intended recipient, please delete and contact the sender immediately. Please consider the environment before printing this e-mail. AVIS : le pr?sent courriel et toute pi?ce jointe qui l'accompagne sont confidentiels, prot?g?s par le droit d'auteur et peuvent ?tre couverts par le secret professionnel. Toute utilisation, copie ou divulgation non autoris?e est interdite. Si vous n'?tes pas le destinataire pr?vu de ce courriel, supprimez-le et contactez imm?diatement l'exp?diteur. Veuillez penser ? l'environnement avant d'imprimer le pr?sent courriel

RE: Hadoop Java compilation error

Posted by "Kartashov, Andy" <An...@mpac.ca>.
In order to run Hadoop program you will need it run it as follows:

$hadoop jar <jar-name>.jar <class-name>

Where:
class-name is comiled .class file with main() method
name-jar is a jar containing .class files

Compile your HelloWorld.java into HelloWorld.class. Create a jar file from HelloWorld.class and call it , say HW.jar

Then execute the program as follows:
$hadoop jar HW.jar HelloWorld

Happy Hadooping,
AK7

From: Robert Evans [mailto:evans@yahoo-inc.com]
Sent: Wednesday, November 14, 2012 4:37 PM
To: user@hadoop.apache.org; R J
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 <rj...@yahoo.com>>
Reply-To: "user@hadoop.apache.org<ma...@hadoop.apache.org>" <us...@hadoop.apache.org>>, R J <rj...@yahoo.com>>
Date: Wednesday, November 14, 2012 3:00 PM
To: "user@hadoop.apache.org<ma...@hadoop.apache.org>" <us...@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
/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.
NOTICE: This e-mail message and any attachments are confidential, subject to copyright and may be privileged. Any unauthorized use, copying or disclosure is prohibited. If you are not the intended recipient, please delete and contact the sender immediately. Please consider the environment before printing this e-mail. AVIS : le pr?sent courriel et toute pi?ce jointe qui l'accompagne sont confidentiels, prot?g?s par le droit d'auteur et peuvent ?tre couverts par le secret professionnel. Toute utilisation, copie ou divulgation non autoris?e est interdite. Si vous n'?tes pas le destinataire pr?vu de ce courriel, supprimez-le et contactez imm?diatement l'exp?diteur. Veuillez penser ? l'environnement avant d'imprimer le pr?sent courriel

Re: Hadoop Java compilation error

Posted by Robert Evans <ev...@yahoo-inc.com>.
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 <rj...@yahoo.com>>
Reply-To: "user@hadoop.apache.org<ma...@hadoop.apache.org>" <us...@hadoop.apache.org>>, R J <rj...@yahoo.com>>
Date: Wednesday, November 14, 2012 3:00 PM
To: "user@hadoop.apache.org<ma...@hadoop.apache.org>" <us...@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
/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.

Re: Hadoop Java compilation error

Posted by Robert Evans <ev...@yahoo-inc.com>.
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 <rj...@yahoo.com>>
Reply-To: "user@hadoop.apache.org<ma...@hadoop.apache.org>" <us...@hadoop.apache.org>>, R J <rj...@yahoo.com>>
Date: Wednesday, November 14, 2012 3:00 PM
To: "user@hadoop.apache.org<ma...@hadoop.apache.org>" <us...@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
/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.

Re: Hadoop Java compilation error

Posted by Robert Evans <ev...@yahoo-inc.com>.
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 <rj...@yahoo.com>>
Reply-To: "user@hadoop.apache.org<ma...@hadoop.apache.org>" <us...@hadoop.apache.org>>, R J <rj...@yahoo.com>>
Date: Wednesday, November 14, 2012 3:00 PM
To: "user@hadoop.apache.org<ma...@hadoop.apache.org>" <us...@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
/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.

Re: Hadoop Java compilation error

Posted by Robert Evans <ev...@yahoo-inc.com>.
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 <rj...@yahoo.com>>
Reply-To: "user@hadoop.apache.org<ma...@hadoop.apache.org>" <us...@hadoop.apache.org>>, R J <rj...@yahoo.com>>
Date: Wednesday, November 14, 2012 3:00 PM
To: "user@hadoop.apache.org<ma...@hadoop.apache.org>" <us...@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
/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.