title: Hadoop HDFS PutMerge doesn't work
body: <p>I try to run the PutMerge in Hadoop in Action on my computer. But it doesn't work. I create several files on my local machine Following is the code</p>
  
  <pre><code>package org.apache.hadoop.examples;
  
  import java.io.IOException;
  import org.apache.hadoop.conf.Configuration;
  import org.apache.hadoop.fs.FSDataInputStream;
  import org.apache.hadoop.fs.FSDataOutputStream;
  import org.apache.hadoop.fs.FileStatus;
  import org.apache.hadoop.fs.FileSystem;
  import org.apache.hadoop.fs.Path;
  
  public class PutMerge {
  
  public static void main(String[] args) throws IOException {
  
      Configuration conf = new Configuration();
      FileSystem hdfs = FileSystem.get(conf);
      FileSystem local = FileSystem.getLocal(conf);
  
      Path inputDir = new Path("/home/yehang/Documents/example");
      Path hdfsFile = new Path("hdfs://localhost:54310:/user/yehang");
  
      //System.out.println(inputDir);
      //System.out.println(hdfsFile);
  
      try {
          FileStatus[] inputFiles = local.listStatus(inputDir);
          //System.out.println(inputFiles);
          FSDataOutputStream out = hdfs.create(hdfsFile);
          //System.out.println(out);
  
          for (int i = 0; i &lt; inputFiles.length; i++) {
              System.out.println(inputFiles[i].getPath().getName());
              FSDataInputStream in = local.open(inputFiles[i].getPath());
              byte buffer[] = new byte[256];
              int bytesRead = 0;
              while ((bytesRead = in.read(buffer)) &gt; 0) {
                  out.write(buffer, 0, bytesRead);
              }
              in.close();
          }
          out.close();
      } catch (IOException e) {
          e.printStackTrace();
  
      }
  
  }
  </code></pre>
  
  <p>}</p>
  
  <p>And when I run it on hadoop, it came out following error:</p>
  
  <pre><code>  Exception in thread "main" java.lang.IllegalArgumentException: Wrong FS:        hdfs://localhost:54310:/user, expected: file:///
  at org.apache.hadoop.fs.FileSystem.checkPath(FileSystem.java:381)
  at org.apache.hadoop.fs.RawLocalFileSystem.pathToFile(RawLocalFileSystem.java:55)
  at org.apache.hadoop.fs.RawLocalFileSystem.mkdirs(RawLocalFileSystem.java:335)
  at org.apache.hadoop.fs.ChecksumFileSystem.mkdirs(ChecksumFileSystem.java:492)
  at org.apache.hadoop.fs.ChecksumFileSystem.create(ChecksumFileSystem.java:377)
  at org.apache.hadoop.fs.ChecksumFileSystem.create(ChecksumFileSystem.java:364)
  at org.apache.hadoop.fs.FileSystem.create(FileSystem.java:555)
  at org.apache.hadoop.fs.FileSystem.create(FileSystem.java:536)
  at org.apache.hadoop.fs.FileSystem.create(FileSystem.java:443)
  at org.apache.hadoop.fs.FileSystem.create(FileSystem.java:435)
  at org.apache.hadoop.examples.PutMerge.main(PutMerge.java:28)
  </code></pre>
  
  <p>Who can help me?</p>