在eclipse开发hadoop文件上传功能,出现版本不一致问题。hadoop版本是2.2.0

2025-03-25 01:50:01
推荐回答(1个)
回答1:

static String INPUT_PATH = "hdfs://hadoop0:9000/VERSION";

public static void ma攻场掇渡墀盗峨醛法互in(String[] args) throws Exception{
final FileSystem fileSystem = FileSystem.get(new URI(INPUT_PATH), new Configuration());
//put
final FSDataOutputStream out = fileSystem.create(new Path("/dir1/hosts"));
IOUtils.copyBytes(new FileInputStream(new File("C:\\Windows\\System32\\drivers\\etc\\hosts")), out, 1024, true);