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 solved this in my env, without modify hadoop-env.sh
You'd be better using /bin/bash as default shell not /bin/sh
Check these before:
echo $JAVA_HOME)echo $SHELL in every node, check if print /bin/bash
if not, vi /etc/passwd, add /bin/bash at tail of your username
ref
Changing default shell in Linux
https://blog.csdn.net/whitehack/article/details/51705889
You can add in your .bashrc file:
export JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:bin/java::")
and it will dynamically change when you update your packages.
Above error is because of the space in between two words.
Eg: Java located in C:\Program Files\Java --> Space in between Program and files would cause the above problem. If you remove the space, it would not show any error.
Make sure that you have removed the comment tag and changed your JAVA_HOME in the hadoop-env.sh as well as the appropriate .bashrc and/or .profile:
# export JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk
should be
export JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk
You can set your JAVA_HOME and PATH for all users (make sure you haven't previously set this to the wrong path) in /etc/profile.
Also, don't forget to activate the new change by logging-out/in or by executing source /etc/profile.
I tried changing /etc/environment:
JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64"
on the slave node, it works.
Type echo $JAVA_HOME in your terminal to be sure your JAVA_HOME is set.
You can also type java -version to know what version of java you are actually using.
By the way, reading your description it seems your actually writing
export JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk
in the file conf/hadoop-env.sh, you should write it in your terminal or in ~/.bashrc or ~/.profile then type source < path to modified file >.