一、向hdfs上上传文件
首先需要进行配置文件的配置
Configuration conf = new Configuration();
//进行conf的设置
conf.set("fs.defaultFS","hdfs://hadoop01:9000/");
//通过配置文件得到fs的实例
FileSystem fs = FileSystem.get(conf);
//通过fs中封装的方法实现相应的需求
//创建一个保存文件的路径
原文:http://www.cnblogs.com/xzdblogs/p/6377514.html