理解HDFS Java API编程原理;
掌握HDFS的命令;
掌握Elipse远程调试Hadoop程序的方法;
掌握HDFS基本的API调用方法
删除传入的路径下的指定的文件
1. package hdfsapi; 2. 3. import java.io.IOException; 4. import java.net.URI; 5. 6. import org.apache.hadoop.conf.Configuration; 7. import org.apache.hadoop.fs.FileSystem; 8. import org.apache.hadoop.fs.Path; 9. 10. public class E5_DeleteAPI { 11. public static void main(String[] args) throws IOException, InterruptedException { 12. Configuration conf = new Configuration(); 13. conf.set("fs.defaultFS", "hdfs://master:8020"); 14. FileSystem fs = FileSystem.get(URI.create("hdfs://master:8020"), conf, "root"); 15. fs.delete(new Path("/user/root/text1"), true); 16. System.out.println("done!"); 17. } 18. 19. }