title: Nutch 1.7 JAVA_HOME not set Error
body: <p>I'm experimenting <strong>Apache Nutch 1.7</strong> and <strong>Solr</strong> on <strong>Ubuntu 14.04 x64 (AMD) LTS</strong> and when i try to run Nutch, it gives me this error message:</p>
  
  <blockquote>
    <p>Error: JAVA_HOME is not set.</p>
  </blockquote>
  
  <p>But when i type <strong>echo $JAVA_HOME</strong> command on terminal, it gives me this path:
  <strong>/usr/lib/jvm/java-7-openjdk-amd64</strong></p>
  
  <p>Below you can see what i've done step by step. How can i fix this?</p>
  
  <p><strong>*ps</strong>: Ubuntu is a virtual machine which runs on Mac with Oracle VirtualBox</p>
  
  <ol>
  <li>Intalling java on terminal with <strong>sudo apt-get -y install openjdk-7-jdk</strong></li>
  <li>Checking java installation by <strong>java -version</strong> command</li>
  <li><p>Setting JAVA_HOME with:</p></li>
  <li><p><strong>sudo nano /etc/environment</strong></p></li>
  <li><p>Then typing following line at the bottom of file: <strong>JAVA_HOME="/usr/lib/jvm/java-7-openjdk-amd64"</strong></p></li>
  <li><p>kntrl+X shortcut for Saving changes.</p></li>
  <li><p>Then this command: <strong>source /etc/environment</strong></p></li>
  <li><p>Now JAVA_HOME must be set. I checked it by following command and it gives me the path. <strong>echo $JAVA_HOME</strong> and output is same as above.</p></li>
  <li><p>Then i installed Solr by <strong>sudo apt-get -y install solr-tomcat</strong></p></li>
  <li><p>I controlled installation by typing this address in a browser: <strong><code>http://localhost:8080/solr</code></strong> and it shows me initial page of solr</p></li>
  <li><p>I downloaded Apache Nutch 1.7 from <a href="http://nutch.apache.org" rel="nofollow noreferrer">http://nutch.apache.org</a> and file was named as apache-nutch-1.7.-bin.tar.gz</p></li>
  <li><p>Then extract it: <strong>tar -zxvf apache-nutch-1.7-bin.tar.gz</strong></p></li>
  <li><p>I verfied Nutch's installation by simply this:
  <strong>cd apache-nutch-1.7</strong> then 
  <strong>bin/nutch</strong>
  And the output is like <strong>Usage: nutch COMMAND where......</strong></p></li>
  <li><p>Then i edit my <strong>conf/nutch-site.xml</strong> file as in here: <a href="http://www.opensourceconnections.com/blog/2014/05/24/crawling-with-nutch/" rel="nofollow noreferrer"><strong><em>Link</em></strong></a> (You need to look under this title: "<strong>3) Set Up Your Nutch-Site.Xml</strong>" )
  Things i did different from that last reference are; MyBot  and MyBot,* fields. Instead of <em>MyBot</em> i wrote <em>mySpider</em></p></li>
  <li><p>Then i get in conf directory of nutch with Terminal. Here's what i did after:
  <strong>mkdir -p urls</strong> , 
  <strong>cd urls</strong> , 
  <strong>touch seed.txt</strong> , 
  <strong>nano seed.txt</strong></p></li>
  <li><p>i only wrote this url in the file as it's suggested in official tutorial of nutch:
  <a href="http://nutch.apache.org" rel="nofollow noreferrer">http://nutch.apache.org</a></p></li>
  </ol>
  
  <p>17After i saved my changed in seed.txt file. I edit the conf/regex-urlfilter.txt file. I delete these two lines:</p>
  
  <blockquote>
    <h1>accept anything else</h1>
    
    <p>+.</p>
  </blockquote>
  
  <p>Then i wrote this instead of them:</p>
  
  <blockquote>
    <p><code>+^http://([a-z0-9]*\.)*nutch.apache.org/</code></p>
  </blockquote>
  
  <p>After that,</p>
  
  <p>I used this command as it's suggested in tutorial:
  <strong>bin/nutch crawl urls -dir crawl -depth 3 -topN 5</strong></p>
  
  <p><strong>After this command i see this error message:
  Error: JAVA_HOME is not set.</strong></p>
  
  <p>I also found this article but it didn't solve my problem either:
  <a href="https://stackoverflow.com/questions/24771239/nutch-getting-error-java-home-is-not-set-when-trying-to-crawl">Nutch - Getting Error: JAVA_HOME is not set. when trying to crawl</a></p>