import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.junit.Before;
import org.junit.Test;
import java.net.URI;
public class Java_HDFS {
//定义文件系统,类变量
FileSystem fs=null;
//预处理,定义在@Test之前
@Before
public void init() throws Exception {
//这里id设置自己本虚拟机的id号,root是用户名
fs=FileSystem.get(new URI("hdfs://192.168.44.128:9000"),new Configuration(),"root");
}
@Test
public void printFS(){
System.out.println(fs);
}
}



