hadoop-common-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From C G <parallel...@yahoo.com>
Subject Re: Newbie question...with appropriate apologies in advance...
Date Fri, 27 Jul 2007 02:24:25 GMT
Thanks Lucas...I did run everything that way to test and evaluate.  Now I'm just trying to
figure out how to build and deploy my own code.

Lucas Nazário dos Santos <nazario.lucas@gmail.com> wrote:  Hello.

My reply is embedded with your text, marked with ###.

Cheers,
Lucas



On 7/26/07, C G 
wrote:
>
> I've deployed hadoop-0.13.0 and successfully run some examples. Now I am
> trying to compile and run the examples prior to starting to develop my own
> code. I've managed to do little more than get a nice spew of error
> messages. This is no doubt due to my own ignorance and too much Python
> programming, but can anybody tell me how to compile the examples (
> WordCount.java for example) and run them?


##########################################################
You don't need to compile the examples. They already come compiled for you
inside Hadoop's home folder, wrapped in the jar named
hadoop-0.13.0-examples.jar.
##########################################################

I apologize for the basic question, which I am sure is classpath-magic
> related. Any assistance most appreciated. I promise to be helpful to other
> newbs like myself going forward.
>
> I've tried a bunch of stuff, but it all comes down to various "can't
> find class X' errors. This is representative of as far as I've gotten:
> % java -version
> java version "1.6.0_02"
> Java(TM) SE Runtime Environment (build 1.6.0_02-b05)
> Java HotSpot(TM) Client VM (build 1.6.0_02-b05, mixed mode, sharing
> % cd ${HADOOP_HOME}/hadoop-0.13.0
> /src/examples/org/apache/hadoop/examples
> % javac -classpath ${HADOOP_HOME}/hadoop-0.13.0/hadoop-0.13.0-core.jar
> WordCount.java
> % jar -cvf WordCount.jar *.class
> % cp *.jar ${HADOOP_HOME/hadoop-0.13.0/
> % cd ${HADOOP_HOME/hadoop-0.13.0/
> % bin/hadoop jar WordCount.jar WordCount input_files/text.txt
> output_files/results2.txt
> Exception in thread "main" java.lang.NoClassDefFoundError: WordCount
> (wrong name: org/apache/hadoop/examples/WordCount)
> at java.lang.ClassLoader.defineClass1(Native Method)
> at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
> at java.security.SecureClassLoader.defineClass(
> SecureClassLoader.java:124)
> at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
> at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
> at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
> at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
> at java.lang.Class.forName0(Native Method)
> at java.lang.Class.forName(Class.java:247)
> at org.apache.hadoop.util.RunJar.main(RunJar.java:148)


##########################################################
Instead of issuing

% bin/hadoop jar WordCount.jar WordCount input_files/text.txt
output_files/results2.txt

try something like

% bin/hadoop jar hadoop-0.13.0-examples.jar wordcount input_files
output_files

Notice that you must copy your input files to HDFS, under the folder named
input_files (you can use bin/hadoop -put command). You also
musn't create the folder output_files, because Hadoop will create it
automatically for you. And don't forget to run Hadoop's tasktracker
(bin/hadoop tasktracker).
##########################################################

---------------------------------
> Luggage? GPS? Comic books?
> Check out fitting gifts for grads at Yahoo! Search.


       
---------------------------------
Take the Internet to Go: Yahoo!Go puts the Internet in your pocket: mail, news, photos &
more. 
Mime
  • Unnamed multipart/alternative (inline, 8-Bit, 0 bytes)
View raw message