Rigid set JAVA_HOME variable in Linux [duplicate]
Put the line export JAVA_HOME=/path/to/java
at the beginning of your start-all.sh script, and that should do it.
$ vi ~/.bash_proflle
append this line to the file
export JAVA_HOME=/opt/jdk1.7.0_06
that will make permanent changes to JAVA_HOME
environment variable.
You shoud set JAVA_HOME in hadoop-env.sh
file also. Which is in $HADOOP_INSTALL/hadoop/conf
directory of hadoop. by default JAVA_HOME setting line is commented
hadoop-env.sh - This file contains some environment variable settings used by Hadoop. You can use these to affect some aspects of Hadoop daemon behavior, such as where log files are stored, the maximum amount of heap used etc. The only variable you should need to change in this file is JAVA_HOME
Or You can add it in following file in hadoop account.
~/.bash_proflle