title: How to Read file from Hadoop using Java without command line
body: <p>I wanted to read file from hadoop system, I could do that using the below code</p>
  
  <pre><code>String uri = theFilename;
  Configuration conf = new Configuration();
  FileSystem fs = FileSystem.get(URI.create(uri), conf);
  InputStream in = null;
  try {
    in = fs.open(new Path(uri));
    IOUtils.copyBytes(in, System.out, 4096, false);
  } finally {
    IOUtils.closeStream(in);
  }
  </code></pre>
  
  <p>To run this file I have to run hadoop jar myjar.jar com.mycompany.cloud.CatFile /filepathin_hadoop
  That works. But How can I do that same from other program, I mean without using hadoop jar command.</p>