I\'m trying to install Hadoop on Ubuntu 11.10. I set the JAVA_HOME
variable in the file conf/hadoop-env.sh
to:
# export JAVA_HOME=
I tried the above solutions but the following worked on me
export JAVA_HOME=/usr/java/default
Here we provide simple steps to setup JAVA_HOME while installing of Hadoop
Step1: Goto Java library path /lib jvm
Then set the JAVA_HOME & PATH in .bashrc file
Source : http://commandstech.com/hadoop-error-java_home-is-not-set-and-could-not-be-found-in-hadoop-installation/
Step 2 : Once it is done then go with Hadoop env file then update it.
After once it is done then stop the daemons and start daemons once again.
The solution that worked for me was setting my JAVA_HOME
in /etc/environment
Though JAVA_HOME
can be set inside the /etc/profile files, the preferred location for JAVA_HOME
or any system variable is /etc/environment
.
Open /etc/environment in any text editor like nano or vim and add the following line:
JAVA_HOME="/usr/lib/jvm/your_java_directory"
Load the variables:
source /etc/environment
Check if the variable loaded correctly:
echo $JAVA_HOME
In some distributives(CentOS/OpenSuSe,...) will work only if you set JAVA_HOME in the /etc/environment.
You should set JAVA_HOME
in the hadoop-env.sh
file also which is in the Hadoop configuration directory.
By default the JAVA_HOME
setting line is commented.
Copy this export JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk
to hadoop-env.sh
file.
JAVA_HOME
is the location where java binaries are present.