Where is the classpath for hadoop set? When I run the below command it gives me the classpath. Where is the classpath set?
bin/hadoop classpath
I'm using hadoop 2.6.0
Where is the classpath for hadoop set? When I run the below command it gives me the classpath. Where is the classpath set?
bin/hadoop classpath
I'm using hadoop 2.6.0
Open your bash profile (
~/.profile
or~/.bash_profile
) for editing and add the following:HADOOP_HOME="/usr/local/Cellar/hadoop"
then Replace with your own pathexport
HADOOP_CLASSPATH=$(find $HADOOP_HOME -name '*.jar' | xargs echo | tr ' ' ':')
Save the changes and reload.source
~/.profile
As said by almas shaikh it's set in
hadoop-config.sh
, but you could add more jars to it inhadoop-env.sh
Here is a relevant code from
hadoop-env.sh
which adds additional jars like capacity-scheduler and aws jar's.As per this blog post, it is in an environment variable named
HADOOP_CLASSPATH
. You can set it as you would any other environment variable, the specifics of which depend on which shell you use. If you usebash
, then you can call likeexport HADOOP_CLASSPATH=/path/to/wherever:/path/to/wherever/else
.When you run
hadoop
command, it sources a filehadoop-config.sh
that resides in$HADOOP_HDFS_HOME/libexec
which sets your classpath (CLASSPATH) by picking jars residing in various directories viz.