这是我的程序,我想从我的hdfs读取,我使用map reduce程序创建,但它不显示任何输出。没有任何编译时和运行时错误。尝试从Hdfs输出读取hadoop
import java.io.BufferedReader;
import java.io.InputStreamReader;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
public class Cat{
public static void main (String [] args) throws Exception{
try{
Path pt=new Path("hdfs:/path/to/file");
FileSystem fs = FileSystem.get(new Configuration());
BufferedReader br=new BufferedReader(new InputStreamReader(fs.open(pt)));
String line;
line=br.readLine();
while (line != null){
System.out.println(line);
line=br.readLine();
}
}catch(Exception e){
}
}
}
用户是否试图执行Java代码'拥有'HDFS'中的输出文件'? –