這是我的程序,我想從我的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'中的輸出文件'? –