I am a beginner with hadoop and trying to install and run hadoop in my Ubuntu as a single node cluster. This is my JAVA_HOME in my hadoop_env.sh
# The java
It not know space between Program and Files: "Program Files". So, I copy folder of jdk to C: or folder which not contains space in name of folder and assign: export JAVA_HOME=Name_Path_Copied. I see it run ok
I debugged the code and found out that even though JAVA_HOME is set in the environment, the value is lost as ssh connections to other hosts is made inside the code, and the JAVA_HOME variable that was showing well set in start-dfs.sh became unset in hadoop-env.sh.
The solution to this problem will be to set JAVA_HOME variable in hadoop-env.sh and it should work properly.
Above answers should work as long as you are using default conf directory $HADOOP_HOME/conf
or $HADOOP_HOME/etc/hadoop
. Here are a few things you should do if you're using a different conf folder.
hadoop-env.sh
file from the default conf directory to your conf folder, say /home/abc/hadoopConf
.Replace the line
#export JAVA_HOME=${JAVA_HOME}
with the following:
export JAVA_HOME=/usr/lib/jvm/java-8-oracle
export HADOOP_CONF_DIR=/home/abc/hadoopConf
Change the values appropriately. If you have any other environment variables related to hadoop configured in your .bashrc
or .profile
or .bash_profile
consider adding them next to the above lines.
I had the same error and solved it with Soil Jain's remark, but to make it even a bit more clear: the hadoop-env.sh uses an expression such as
export JAVA_HOME=${JAVA_HOME}
if you hard-code the path to your JVM installation it works
export JAVA_HOME=/usr/lib/jvm/java...
this resolution by environmental variable as is seems to fail. Hard-coding fixed the problem for me.
Are you loading hadoop_env.sh
? you may be refering to hadoop-env.sh
( dash instead of underscore - that is under conf directory)
BTW, This is a very useful guide for quick installation :
http://www.michael-noll.com/tutorials/running-hadoop-on-ubuntu-linux-single-node-cluster/
First, you must set JAVA_HOME in your hadoop_env.sh
. (your local JAVA_HOME in .bashrc would likely to be ignore somehow)
# The java implementation to use.
export JAVA_HOME=/usr/lib/jvm/default-java
Then, set HADOOP_CONF_DIR
point to directory of your hadoop_env.sh
. In ~/.bashrc, add the following line:
HADOOP_CONF_DIR="/usr/local/hadoop/etc/hadoop"
export HADOOP_CONF_DIR
Where /usr/local/hadoop/etc/hadoop
is the directory contained hadoop_env.sh