java代码如下:
FileSystem fs = FileSystem.get(conf);
if (fs.exists(inputDir)) {
throw new IOException(String.format("Input directory '%s' exists - please remove and rerun this example", inputDir));
}
OutputStreamWriter writer = new OutputStreamWriter(fs.create(new Path(inputDir, "input2.txt")));
writer.write(JSON);
抛出异常如下:Exception in thread "main" java.lang.IllegalArgumentException: Wrong FS: hdfs://hadoop:9000/test/input, expected: file:///
at org.apache.hadoop.fs.FileSystem.checkPath(FileSystem.java:381)at org.apache.hadoop.fs.RawLocalFileSystem.pathToFile(RawLocalFileSystem.java:55)
at org.apache.hadoop.fs.LocalFileSystem.pathToFile(LocalFileSystem.java:61)
at org.apache.hadoop.fs.LocalFileSystem