title: Failed to detect a valid hadoop home directory
body: <p>I have set up Hadoop 2.2.0 single node and started it up. I am able to browse the FS on <code>http://localhost:50070/</code>
  Then I tried to write a dummy file using the following code.</p>
  
  <pre><code>public class Test {
  public void write(File file) throws IOException{
      FileSystem fs = FileSystem.get(new Configuration());
      Path outFile = new Path("test.jpg");       
      FSDataOutputStream out = fs.create(outFile);        
  
  }    
  </code></pre>
  
  <p>I get the following exception</p>
  
  <pre><code>INFO:   DEBUG - field org.apache.hadoop.metrics2.lib.MutableRate org.apache.hadoop.security.UserGroupInformation$UgiMetrics.loginSuccess with annotation @org.apache.hadoop.metrics2.annotation.Metric(valueName=Time, value=[Rate of successful kerberos logins and latency (milliseconds)], about=, type=DEFAULT, always=false, sampleName=Ops)
      INFO:   DEBUG - field org.apache.hadoop.metrics2.lib.MutableRate org.apache.hadoop.security.UserGroupInformation$UgiMetrics.loginFailure with annotation @org.apache.hadoop.metrics2.annotation.Metric(valueName=Time, value=[Rate of failed kerberos logins and latency (milliseconds)], about=, type=DEFAULT, always=false, sampleName=Ops)
      INFO:   DEBUG - UgiMetrics, User and group related metrics
      INFO:   DEBUG -  Creating new Groups object
      INFO:   DEBUG - Trying to load the custom-built native-hadoop library...
      INFO:   DEBUG - Failed to load native-hadoop with error: java.lang.UnsatisfiedLinkError: no hadoop in java.library.path
      INFO:   DEBUG - java.library.path=/usr/lib/jvm/jdk1.7.0/jre/lib/amd64:/usr/lib/jvm/jdk1.7.0/jre/lib/i386::/usr/java/packages/lib/i386:/lib:/usr/lib
      INFO:   WARN - Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
      INFO:   DEBUG - Falling back to shell based
      INFO:   DEBUG - Group mapping impl=org.apache.hadoop.security.ShellBasedUnixGroupsMapping
      INFO:   DEBUG - Group mapping impl=org.apache.hadoop.security.JniBasedUnixGroupsMappingWithFallback; cacheTimeout=300000
      INFO:   DEBUG - hadoop login
      INFO:   DEBUG - hadoop login commit
      INFO:   DEBUG - using local user:UnixPrincipal: qualebs
      INFO:   DEBUG - UGI loginUser:qualebs (auth:SIMPLE)
      INFO:   DEBUG - Failed to detect a valid hadoop home directory
      java.io.IOException: HADOOP_HOME or hadoop.home.dir are not set.
          at org.apache.hadoop.util.Shell.checkHadoopHome(Shell.java:225)
          at org.apache.hadoop.util.Shell.&lt;clinit&gt;(Shell.java:250)
          at 
      org.apache.hadoop.fs.RawLocalFileSystem.setPermission(RawLocalFileSystem.java:639)
          at org.apache.hadoop.fs.FilterFileSystem.setPermission(FilterFileSystem.java:468)
          at org.apache.hadoop.fs.ChecksumFileSystem.create(ChecksumFileSystem.java:456)
          at org.apache.hadoop.fs.ChecksumFileSystem.create(ChecksumFileSystem.java:424)
          at org.apache.hadoop.fs.FileSystem.create(FileSystem.java:905)
          at org.apache.hadoop.fs.FileSystem.create(FileSystem.java:886)
          at org.apache.hadoop.fs.FileSystem.create(FileSystem.java:783)
          at org.apache.hadoop.fs.FileSystem.create(FileSystem.java:772)
          at com.qualebs.managers.HadoopDFS.writer(HadoopDFS.java:41)
  </code></pre>
  
  <p>Where do I set the HADOOP_HOME or hadoop.home.dir?
  Operating system is Ubuntu 11.10 </p>
  
  <p>The only configuration files I have configured are the following with the properties added</p>
  
  <ol>
  <li>core-site.xml </li>
  </ol>
  
  <p></p>
  
  <pre><code>&lt;configuration&gt;
      &lt;property&gt;
          &lt;name&gt;fs.default.name&lt;/name&gt;
          &lt;value&gt;hdfs://localhost:9000&lt;/value&gt;
      &lt;/property&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <ol start="2">
  <li>hdfs-site.xml</li>
  </ol>
  
  <p></p>
  
  <pre><code>&lt;configuration&gt;
      &lt;property&gt;
          &lt;name&gt;dfs.replication&lt;/name&gt;
          &lt;value&gt;1&lt;/value&gt;
      &lt;/property&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <ol start="3">
  <li>mapred-site.xml.template</li>
  </ol>
  
  <p></p>
  
  <pre><code>&lt;configuration&gt;
      &lt;property&gt;
          &lt;name&gt;mapred.job.tracker&lt;/name&gt;
          &lt;value&gt;localhost:9001&lt;/value&gt;
      &lt;/property&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>Eagerly awaiting your responses.</p>