Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

From where hadoop gets JAVA_HOME variable value?

Tags:

hadoop

I have set JAVA_HOME correctly and when I echo it, I see the correct value:

$ echo $JAVA_HOME
/usr/lib/jvm/java-6-openjdk-amd64/

I have also put the JAVA_HOME value to the hadoop-env.sh.

$ grep JAVA_HOME conf/hadoop-env.sh 
# The only required environment variable is JAVA_HOME.  All others are
# set JAVA_HOME in this file, so that it is correctly defined on
export JAVA_HOME="/usr/lib/jvm/java-6-openjdk-amd64/"

Despite all of this, hadoop still shows the JAVA_HOME variable totally different. I dont know where it gets this value. Any suggestions?

$ hadoop noname -format
Warning: $HADOOP_HOME is deprecated.

/usr/bin/hadoop: line 320: /usr/lib/jvm/java-6-sun/bin/java: No such file or directory
/usr/bin/hadoop: line 390: /usr/lib/jvm/java-6-sun/bin/java: No such file or directory
like image 305
Ali Ismayilov Avatar asked Jan 11 '13 20:01

Ali Ismayilov


1 Answers

I had the same problem on my Hadoop install as well. I found in /etc/hadoop/hadoop-env.sh JAVA_HOME was hardcoded to be /usr/lib/jvm/java-6-sun. I went ahead and changed it to ${JAVA_HOME} and that seemed to do the trick.

like image 120
Uncle Bob Avatar answered Oct 13 '22 09:10

Uncle Bob