Could not find or load main class org.apache.hadoop.fs.FsShell
<p>I understand this question might have been answered already, well, my issue is still here:</p>

<p>I have a vm created for hadoop on vmware using CentOS7, I can start namenode and datanode, however, when I tried to view hdfs file using the following command:</p>

<pre><code>hdfs dfs -ls
</code></pre>

<p>it throws out an error below:</p>

<pre><code>Could not find or load main class org.apache.hadoop.fs.FsShell
</code></pre>

<p>My google searchings suggest this might relate to hadoop variables setting in bash, here is my settings:</p>

<pre><code># .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
export HADOOP_HOME=/opt/hadoop/hadoop-2.7.2
export HADOOP_MAPRED_HOME=$HADOOP_HOME
export HADOOP_COMMON_HOME=$HADOOP_HOME
export HADOOP_HDFS_HOME=$HADOOP_HOME
export HADOOP_YARN_HOME=$HADOOP_HOME
export HADOOP_CONF_DIR=$HADOOP_HOME/etc/hadoop
export HADOOP_PREFIX=$HADOOP_HOME

export HIVE_HOME=/opt/hadoop/hive
export PATH=$HIVE_HOME/bin:$PATH

export ANT_HOME=/usr/local/apache-ant-1.9.7
export PATH=${PATH}:${JAVA_HOME}/bin

export PIG_HOME=/opt/hadoop/pig-0.15.0
export PIG_HADOOP_VERSION=0.15.0
export PIG_CLASSPATH=$HADOOP_HOME/etc/hadoop

export PATH=$PATH:$PIG_HOME/bin
export PATH=$PATH:$HADOOP_HOME/bin
export HADOOP_USER_CLASSPATH_FIRST=true

export SQOOP_HOME=/usr/lib/sqoop
export PATH=$PATH:$SQOOP_HOME/bin

export HADOOP_CLASSPATH=$HADOOP_HOME/share/hadoop/common/
export PATH=$PATH:$HADOOP_CLASSPATH

# Uncomment the following line if you don't like systemctl's auto-paging feature
:
# export SYSTEMD_PAGER=
# User specific aliases and functions
</code></pre>

<p>I checked my hadoop folder: /opt/hadoop/hadoop-2.7.2/share/hadoop/common, here is the list:
<a href="https://i.stack.imgur.com/bJObX.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bJObX.jpg" alt="enter image description here"></a></p>

<p>I am doing this practice using root account, can anyone help to find out where is the cause of this issue and fix it? Thank you very much.</p>