You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-user@hadoop.apache.org by Rohit Mishra <ro...@rohitmishra.me> on 2010/10/19 20:49:33 UTC

Not able to execute MaxTemperature example

I need clarification on how to run a Hadoop program. I am getting a
ClassNotFoundException error when I try to run the test example given in the
book [Ch 2].

Do we need to first compile the Java files into class files or will the
hadoop command do so automatically? How can we setup the HADOOP_CLASSPATH
variable. The book says "build/classes" Will the build directory be inside
the hadoop directory or under src?

I have placed the source .java files in /hadoop/me/rohitmishra/ch2

I have placed the input files for hadoop MaxTemperature
input/ncdc/sample.txt output directories inside /hadoop/input

When I run the command I get the following error:

rohit@renaissance1:~/hadoop-0.20.2$ hadoop MaxTemperature
input/ncdc/sample.txt output
Exception in thread "main" java.lang.NoClassDefFoundError: MaxTemperature
Caused by: java.lang.ClassNotFoundException: MaxTemperature
 at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
 at java.security.AccessController.doPrivileged(Native Method)
 at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
 at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Could not find the main class: MaxTemperature.  Program will exit.

Regards,
Rohit Mishra
VIT University

Blog: http://www.rohitmishra.me/blog
Twitter: http://twitter.com/movingahead
Facebook: http://www.facebook.com/rohitmishra

Re: Not able to execute MaxTemperature example

Posted by Adarsh Sharma <ad...@orkash.com>.
Rohit Mishra wrote:
> I need clarification on how to run a Hadoop program. I am getting a
> ClassNotFoundException error when I try to run the test example given in the
> book [Ch 2].
>
> Do we need to first compile the Java files into class files or will the
> hadoop command do so automatically? How can we setup the HADOOP_CLASSPATH
> variable. The book says "build/classes" Will the build directory be inside
> the hadoop directory or under src?
>
> I have placed the source .java files in /hadoop/me/rohitmishra/ch2
>
> I have placed the input files for hadoop MaxTemperature
> input/ncdc/sample.txt output directories inside /hadoop/input
>
> When I run the command I get the following error:
>
> rohit@renaissance1:~/hadoop-0.20.2$ hadoop MaxTemperature
> input/ncdc/sample.txt output
> Exception in thread "main" java.lang.NoClassDefFoundError: MaxTemperature
> Caused by: java.lang.ClassNotFoundException: MaxTemperature
>  at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
>  at java.security.AccessController.doPrivileged(Native Method)
>  at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
>  at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
>  at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
>  at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
> Could not find the main class: MaxTemperature.  Program will exit.
>
> Regards,
> Rohit Mishra
> VIT University
>
> Blog: http://www.rohitmishra.me/blog
> Twitter: http://twitter.com/movingahead
> Facebook: http://www.facebook.com/rohitmishra
>
>   
Hi Rohit,
Map-reduce Programs are executed either by *Setting Eclipse Environment 
for Hadoop *in Eclipse or through command line by making jar of the program.
Check the  below link that clearly explains that :-
http://hadoop.apache.org/common/docs/r0.20.2/mapred_tutorial.html

Best Regards
Adarsh Sharma

Re: Not able to execute MaxTemperature example

Posted by "Maha A. Alabduljalil" <ma...@umail.ucsb.edu>.
Hi Rohit,

  I really learned alot from this link:
http://www.infosci.cornell.edu/hadoop/windows.html

  Maha

Quoting Rohit Mishra <ro...@rohitmishra.me>:

> I need clarification on how to run a Hadoop program. I am getting a
> ClassNotFoundException error when I try to run the test example given in the
> book [Ch 2].
>
> Do we need to first compile the Java files into class files or will the
> hadoop command do so automatically? How can we setup the HADOOP_CLASSPATH
> variable. The book says "build/classes" Will the build directory be inside
> the hadoop directory or under src?
>
> I have placed the source .java files in /hadoop/me/rohitmishra/ch2
>
> I have placed the input files for hadoop MaxTemperature
> input/ncdc/sample.txt output directories inside /hadoop/input
>
> When I run the command I get the following error:
>
> rohit@renaissance1:~/hadoop-0.20.2$ hadoop MaxTemperature
> input/ncdc/sample.txt output
> Exception in thread "main" java.lang.NoClassDefFoundError: MaxTemperature
> Caused by: java.lang.ClassNotFoundException: MaxTemperature
>  at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
>  at java.security.AccessController.doPrivileged(Native Method)
>  at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
>  at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
>  at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
>  at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
> Could not find the main class: MaxTemperature.  Program will exit.
>
> Regards,
> Rohit Mishra
> VIT University
>
> Blog: http://www.rohitmishra.me/blog
> Twitter: http://twitter.com/movingahead
> Facebook: http://www.facebook.com/rohitmishra
>



                      Thank you,

   Maha Alabduljalil
   maha@cs.ucsb.edu