Lostsoul
Lostsoul

Reputation: 25991

JAVA_HOME not being found when launching hbase. Any suggestions?

I'm just playing around with hbase( on EC2) and am having a problem when I launch it. Here's what I get:

[root@domU-12-31-39-13-D6-62 ~]# sudo /etc/init.d/hadoop-hbase-master start
+======================================================================+
|      Error: JAVA_HOME is not set and Java could not be found         |
+----------------------------------------------------------------------+
| Please download the latest Sun JDK from the Sun Java web site        |
|       > http://java.sun.com/javase/downloads/ <                      |
|                                                                      |
| HBase requires Java 1.6 or later.                                    |
| NOTE: This script will find Sun Java whether you install using the   |
|       binary or the RPM based installer.                             |
+======================================================================+

I looked up the error and installed openjdk 1.6 and set the java_home variable in my .bash_profile and in /etc/profile(just in case hbase is running as a different user). It seems to have taken effect:

[root@domU-12-31-39-13-D6-62 ~]# java -version
java version "1.6.0_22"
OpenJDK Runtime Environment (IcedTea6 1.10.4) (rhel-1.42.1.10.4.el6_2-x86_64)
OpenJDK 64-Bit Server VM (build 20.0-b11, mixed mode)
[root@domU-12-31-39-13-D6-62 ~]# echo $JAVA_HOME
/usr/bin/java

but I still get this error when launching hbase. I'm not that famlair with java so I'm not sure what I'm doing wrong. If it helps, I'm using centos6 on ec2 and cloudera's repository for the hbase/hadoop packages.

Upvotes: 3

Views: 8481

Answers (5)

Amit Baderia
Amit Baderia

Reputation: 4882

In case you have already set JAVA_HOME in bashrc and still it is not working, try setting it in /etc/environment file.

Upvotes: 1

Ravindranath Akila
Ravindranath Akila

Reputation: 59

Probably $JAVA_HOME is pointing to a JRE home. Check to confirm if javac is present in the bin

Upvotes: 0

Satish
Satish

Reputation: 17397

You can hard code your JAVA path in your /etc/init.d/hadoop-hbase-master script if you want to quick check.

Upvotes: 0

Satish
Satish

Reputation: 17397

Check your script /etc/init.d/hadoop-hbase-master and see where it trying to find java also your can run it in debug mode.

sh -x /etc/init.d/hadoop-hbase-master start

Upvotes: 2

Peter Svensson
Peter Svensson

Reputation: 6173

JAVA_HOME shouldn't point to the java executable ', but rather to the place where the rest of the java files can be found.

I think it's /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/. I Think you can use update-alternatives --display java to show all javas installed.

Upvotes: 7

Related Questions