hadoop-common-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ryan Wang" <ryanwang.em...@gmail.com>
Subject Any one can tell me about how to write to HDFS?
Date Fri, 30 Nov 2007 14:48:30 GMT
Hi,
I can communicate with the file system via shell command, and it worked
corretly.
But when I try to write program to write file to the file system, it failed.

public class HadoopDFSFileReadWrite {


    public static void main(String[] argv) throws IOException {

        Configuration dfsconf = new Configuration();
        FileSystem dfs = FileSystem.get(dfsconf);

        Path inFile = new Path(argv[0]);
        Path outFile = new Path(argv[1]);

        dfs.copyFromLocalFile(inFile, outFile);
    }
}

argv[0]=nutch/search/bin/javalibTest.tar.gz argv[1]=ryan/test.tar.gz
The program write the javalibTest.tar.gz  to the Project's
Dir/ryan/test.tar.gz
I also placed the file modified hadoop-site.xml to  the Project 's Path?
I don't know why? anyone could help me out ?

Thanks
Ryan

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message