文件上传到hdfs后,读取总说找不到

File imgFile = new File("hdfs://master:9000/input/picture1.jpg");
InputStream is = null;
try {
    is = new FileInputStream(imgFile);
  } catch (FileNotFoundException e1) {
    e1.printStackTrace();
  }

图片说明

把picture1.jpg上传到hdfs后运行,总是说找不到这个文件
把目录改成/input还是不行

试试这个。
String uri = "hdfs://master:9000/input/picture1.jpg";
Configuration conf = new Configuration();
FileSystem fs = FileSystem.get(URI.create(uri), conf);

    InputStream in = null;

    try {
        in = fs.open(new Path(uri));

    } finally {
        IOUtils.closeStream(in);

    }