Package org.apache.hadoop.conf does not exist
You can run it like following:
javac WordCount.java -cp $(hadoop classpath)
If you get following error for this:
zsh: command not found: hadoop
javac: -cp requires an argument
You can try to find exact location of hadoop
, as following worked for me, as I had installed in Mac using brew
(It will be different in Linux):
javac WordCount.java -cp $(/usr/local/Cellar/hadoop/2.8.0/bin/hadoop classpath)
The hadoop classpath provides the compiler with all the paths it needs to compile correctly and you should see a resulting WordCount.class
appear in the directory.
I too have Hadoop 2.7.1 and I am able to compile WordCount.
All your missing packages are from hadoop-common
and hadoop-core
jars.
You need to have following Maven dependencies included in your pom.xml (I just have following dependencies and it compiles for me):
<dependencies> <dependency> <groupId>org.apache.hadoop</groupId> <artifactId>hadoop-hdfs</artifactId> <version>2.7.1</version> </dependency> <dependency> <groupId>org.apache.hadoop</groupId> <artifactId>hadoop-common</artifactId> <version>2.7.1</version> </dependency> <dependency> <groupId>org.apache.hadoop</groupId> <artifactId>hadoop-core</artifactId> <version>1.2.1</version> </dependency></dependencies>