FAQ
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

Search Discussions

  • Maha A. Alabduljalil at Oct 19, 2010 at 9:06 pm
    Hi Rohit,

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

    Maha

    Quoting Rohit Mishra <rohit@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
  • Adarsh Sharma at Oct 20, 2010 at 3:03 am

    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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcommon-user @
categorieshadoop
postedOct 19, '10 at 8:17p
activeOct 20, '10 at 3:03a
posts3
users3
websitehadoop.apache.org...
irc#hadoop

People

Translate

site design / logo © 2022 Grokbase