title: (HBase) Error: JAVA_HOME is not set and Java could not be found
body: <p>I have read some comments about setting JAVA_HOME. As I am a beginner in this,I did not edit anything without any knowledge of what I was doing. I did not want to mess things up more than this.
  So if you can guide me through this and tell me what is wrong with my coding, I would really appreciate it. </p>
  
  <p>I have been trying to install Hadoop and then HBase. After a lot of difficulties and error solving, I could finally install Hadoop, and get the this output when I ran <code>start-all.sh</code> and everything seemed to be fine. </p>
  
  <pre><code>&gt; hduser@CSLAP106:~$ /usr/local/hadoop/bin/start-all.sh
  
  &gt; hduser@CSLAP106:~$ jps
  
  &gt; 3005 NameNode
  
  &gt; 3404 JobTracker
  
  &gt; 5570 Jps
  
  &gt; 3554 TaskTracker
  
  &gt; 3311 SecondaryNameNode
  </code></pre>
  
  <p>I also have this Java Version and when I type <code>echo JAVA_HOME</code>, I get this output:</p>
  
  <pre><code>&gt; hduser@CSLAP106:~$ java -version 
  &gt; 
  &gt; java version "1.7.0_25" OpenJDK Runtime Environment (IcedTea 2.3.12)
  &gt; (7u25-2.3.12-4ubuntu3)   OpenJDK Server VM (build 23.7-b01, mixed
  &gt; mode) 
  &gt; hduser@CSLAP106:~$ echo JAVA_HOME JAVA_HOME
  </code></pre>
  
  <p>After this, I tried to install HBase (which I think I am about to give up on), and constantly I get the error that <code>JAVA_HOME is not set and java cannot be found</code></p>
  
  <p>This is what I tried to start Hbase:</p>
  
  <pre><code>hduser@CSLAP106:~$ /usr/local/hbase/hbase-0.94.6.1/bin/start-hbase.sh
  +======================================================================+
  |      Error: JAVA_HOME is not set and Java could not be found         |
  +----------------------------------------------------------------------+
  | Please download the latest Sun JDK from the Sun Java web site        |
  |       &gt; http://java.sun.com/javase/downloads/ &lt;                      |
  |                                                                      |
  | 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.                             |
  +======================================================================+
  </code></pre>
  
  <p>I also check in this directory <code>/usr/local/hbase/hbase-0.94.6.1/bin</code> to see if it recognizes Java or not, and it does!</p>
  
  <p>After searching through Strackoverflow and other people's answers to the same problem, I tried to apply them to my .xml and .sh files, but again nothing happened. </p>
  
  <p><strong>For HADOOP</strong></p>
  
  <p>this is the <code>hadoop-env.sh</code> in which I set the JAVA_HOME:</p>
  
  <pre><code># The java implementation to use.  Required.
  export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-i386
  </code></pre>
  
  <p>This is the editing for <code>my $HOME/.bashrc</code> :</p>
  
  <pre><code># Set Hadoop-related environment variables
  export HADOOP_HOME=/usr/local/hadoop
  
  export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-i386
  
  # Add Hadoop bin/ directory to PATH
  
  export PATH=$PATH:$HADOOP_HOME/bin
  </code></pre>
  
  <p><strong>For HBase</strong></p>
  
  <p>These are the edits I have made in <code>hbase-site.xml</code></p>
  
  <pre><code>&lt;property&gt;
          &lt;name&gt;hbase.rootdir&lt;/name&gt;
      &lt;value&gt;hdfs://localhost:54310 /hbase&lt;/value&gt;
  &lt;/property&gt;
  </code></pre>
  
  <p>This is for the <code>hbase-env.sh</code></p>
  
  <pre><code># The java implementation to use.  Java 1.6 required.
  # export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-i386
  </code></pre>
  
  <p>This is all I guess. </p>