Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

package org.apache.hadoop.fs does not exist

Tags:

java

hadoop

First, I KNOW THIS HAS BEEN ASKED BEFORE, but none of the solutions work for me and I would like to know why.

I am trying to compile the standard 'WordCount.java' .jar for hadoop on my linux single-node cluster, but keep getting the package org.apache.hadoop.* does not exist error.

I know that I have to edit the $CLASSPATH, but everything I have found online is saying to reference hadoop-core and I cannot find a hadoop-core anywhere in my build (2.4.0). How do I find where org.apache.hadoop.* would exist on my system?

I feel this would be a good 'general' answer since I have seen many questions on this and everyone gives a specific /path/to/classpath/, but it is (apparently) different depending on version and build of hadoop.

like image 595
drjrm3 Avatar asked Nov 03 '14 21:11

drjrm3


1 Answers

As you said, the CLASSPATH you need depends on version, location, and type of installation. How to install it is a separate discussion, but assuming you have a proper hadoop setup installed, it's easy (though I admit, I have no clue where it is documented).

Hadoop provides a convenient utility to get the CLASSPATH information you need. Run this

bin/hadoop classpath

This should give you the information you need set your classpath for compiling your code.

like image 90
D'Nabre Avatar answered Oct 31 '22 20:10

D'Nabre