Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I am installing Hadoop on CentOS 6.4.
Following these instructions

chmod 700 hadoop-1.1.2-1.x86_64.rpm
rpm -Uvh hadoop-1.1.2-1.x86_64.rpm

Java is located at /usr/bin/java

[root@localhost ~]# /usr/bin/java -version
java version "1.7.0_09-icedtea"
OpenJDK Runtime Environment (rhel-
OpenJDK 64-Bit Server VM (build 23.2-b09, mixed mode)


vi /etc/hadoop/ 

export JAVA_HOME=/usr/bin/java/bin/java
export JAVA_HOME=/usr/bin/java

[root@localhost ~]# . /etc/hadoop/
[root@localhost ~]# echo $JAVA_HOME

But Hadoop still fails as it has the old incorrect Java path

[root@localhost ~]# /usr/bin/hadoop version
/usr/bin/hadoop: line 320: /usr/bin/java/bin/java: Not a directory

How do I correct this error message?

share|improve this question

3 Answers 3

up vote 1 down vote accepted

JAVA HOME need to be set just to /usr so that adding bin/java will get you to the right place.

# export JAVA_HOME="/usr"
# /usr/bin/hadoop version
share|improve this answer

JAVA_HOME must always point to the home directory of the java installation, setting to /usr is not recommended in practice. Also, If any of other Applications installed on you box may rely on the JAVA_HOME and it would expect it to point to /usr/java/jdk1.7 (fox ex).

export JAVA_HOME=/usr/java/jdk1.7 (You could do this in /etc/hadoop/

Also, Adding the path of the hadoop Binaries location (for. ex. /usr/local/hadoop/bin) to $PATH would let you to just type the command instead of the full path of the command.

share|improve this answer

As mentioned, problem is solved by setting the real Java location instead of a link to it, to find it:

(Replace the path of 2,3 with the result of the previous one)

$ which java
$ ls -alh /usr/bin/java
$ ls -alh /etc/alternatives/java

Now you can set that in your .bashrc or .profile or wherever you need it.

export JAVA_HOME=/usr/lib/jvm/java-8-oracle
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.