file path in hdfs file path in hdfs hadoop hadoop

file path in hdfs


You can use either of the two ways to solve your error.

1.

String infile = "file.txt";Path ofile = new Path(infile);FileSystem fs = ofile.getFileSystem(getConf());

2.

Configuration conf = getConf();System.out.println("fs.default.name : - " + conf.get("fs.default.name"));// It prints uri  as : hdfs://10.214.15.165:9000 or somethingString uri = conf.get("fs.default.name");FileSystem fs = FileSystem.get(uri,getConf());