标签:throw path oid pack exce pre 获取 package int
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; public class Client { public static void main(String[] args) throws IOException { Configuration conf=new Configuration(); conf.set("fs.defaultFS","hdfs://localhost:9000"); //修改用户方法 //1.vm arguments中添加后面的参数来修改用户 -DHADOOP_USER_NAME=hadoop //2. conf.set使用重载方法修改用户 //1.获取hdfs客户端对象 FileSystem fs=FileSystem.get(conf); //2.在hdfs上创建路径 fs.mkdirs(new Path("/hadoop/example/xy1")); //3.关闭资源 fs.close(); System.out.println("over"); } }
标签:throw path oid pack exce pre 获取 package int
原文地址:https://www.cnblogs.com/abuduri/p/13192002.html