Hadoop WordCount.java Dependency Issues

2019-09-05 21:58发布

问题:

I am trying to compile WordCount.java file into jar inside of /Desktop/Hadoop/playground/src.

Here's the command I am using.

javac -classpath hadoop-1.2.1-core.jar -d playground/classes playground/src/WordCount.java

The compiler seem to be getting invoked, however I am getting tons of errors like this

error: package org.apache.hadoop.conf does not exist import org.apache.hadoop.conf.Configuration

How do I go about fixing this?

May be there is an answer to this issue already. However I could not fix it.

回答1:

You need to set the paths of hadoop-1.2.1-core.jar and all the other dependent jars correctly --

Try this exactly while you are in the Desktop/hadoop directory (valid in your case only solely based upon the inputs you provided in the comments)

javac -classpath *:lib/* -d playground/classes playground/src/WordCount.java