hadoop-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ekta Agrawal <ektacloudst...@gmail.com>
Subject hadoop java connection problem
Date Fri, 06 Jun 2014 10:19:38 GMT
Hi,

I am trying to read and write the file from HDFS.I am trying to read it and
display it on console. It runs without giving any error, warning or
exception but also it is not printing the data from file on console, My
file is already saved in hdfs , I can see it on user interface. I think
there is some problem with the path I have given, I am not sure as I am
connecting hadoop first time to java .I am using eclipse as IDE. Can
somebody look into this?

Code:
Path pt=new Path("hdfs://localhost:54310/user/hduser/project11/a.txt");
 FileSystem fs = FileSystem.get(new Configuration());
  BufferedReader br=new BufferedReader(new InputStreamReader(fs.open(pt)));
   String line;
                while (( line=br.readLine()) != null){
                                System.out.println(line);
                                line=br.readLine();
                        }

 if anybody has some idea of this. Please Share.

Regards,
Ekta

Mime
View raw message