标签:void ted oop int print localhost bsp out string
package com.hadoop.hdfs; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; public class Client { public static void main(String[] args) throws IOException, URISyntaxException, InterruptedException { //1. 获取fs对象 Configuration conf=new Configuration(); FileSystem fs=FileSystem.get(new URI("hdfs://localhost:9000"),conf,"root"); //2. 执行上传API fs.copyFromLocalFile(new Path("e:/example.txt"),new Path("/example.txt")); //3.关闭资源 fs.close(); System.out.println("over"); } }
标签:void ted oop int print localhost bsp out string
原文地址:https://www.cnblogs.com/abuduri/p/13192118.html