Wednesday, June 20, 2012

Hadoop JAVA_HOME is not set error

Most first time users of Hadoop are facing this problem. I thought it is better to write a note on this topic. JAVA_HOME is environment variable that Hadoop needs and most Linux users confuse with word “environment variable”. Linux environment variables can be set in many ways (.bashrc, .bash_profile etc) but hadoop is not looking for this. There is file under hadoop_installation_path/conf/hadoop-env.sh. Open it in edit mode and you should see a line starting with # export JAVA_HOME=.... change its value to the location where you have installed your Java and remove the # in front of the line. You should be able to run Hadoop. Drop a comment if you still face an issue.

1 comment:

tushar sarde said...

After setting the JAVA_HOME path facing this problem ....


$ bin/hadoop namenode
/home/Administrator/hadoop-0.19.1/bin/../conf/hadoop-env.sh: line 2: $'\r': command not found
/home/Administrator/hadoop-0.19.1/bin/../conf/hadoop-env.sh: line 7: $'\r': command not found
/home/Administrator/hadoop-0.19.1/bin/../conf/hadoop-env.sh: line 10: $'\r': command not found
/home/Administrator/hadoop-0.19.1/bin/../conf/hadoop-env.sh: line 13: $'\r': command not found
/home/Administrator/hadoop-0.19.1/bin/../conf/hadoop-env.sh: line 16: $'\r': command not found
/home/Administrator/hadoop-0.19.1/bin/../conf/hadoop-env.sh: line 19: $'\r': command not found
/home/Administrator/hadoop-0.19.1/bin/../conf/hadoop-env.sh: line 29: $'\r': command not found
/home/Administrator/hadoop-0.19.1/bin/../conf/hadoop-env.sh: line 32: $'\r': command not found
/home/Administrator/hadoop-0.19.1/bin/../conf/hadoop-env.sh: line 35: $'\r': command not found
/home/Administrator/hadoop-0.19.1/bin/../conf/hadoop-env.sh: line 38: $'\r': command not found
/home/Administrator/hadoop-0.19.1/bin/../conf/hadoop-env.sh: line 41: $'\r': command not found
/home/Administrator/hadoop-0.19.1/bin/../conf/hadoop-env.sh: line 46: $'\r': command not found
/home/Administrator/hadoop-0.19.1/bin/../conf/hadoop-env.sh: line 49: $'\r': command not found
/home/Administrator/hadoop-0.19.1/bin/../conf/hadoop-env.sh: line 52: $'\r': command not found
bin/hadoop: line 243: /cygdrive/c/Program: No such file or directory
/bin/java: No such file or directoryogram Files/Java/jdk1.6.0_32
/bin/java: cannot execute: No such file or directorys/Java/jdk1.6.0_32