fs.copyToLocalFile(new Path("/**.***"), new Path("e:/**.***"));
報NullPointerException,可能是因爲windows下系統環境變量引起,試驗出兩種解決方法:
InputStream in = fs.open(new Path("/**.***"));
FileOutputStream out = new FileOutputStream(new File("e:/**.***"));
IOUtils.copyBytes(in, out, 2048, true);
使用open方法以及hadoop提供的copyBytes
方法二:
fs.copyToLocalFile(false, new Path("/**.***"), new Path("e:/**.***"), true);
使用帶4個參數的copyToLocalFile方法(