Mac hadoop环境变量配置如下:
已执行 source ~/.bash_profile
查看版本已生效
执行程序报错
代码片段
```java
@Test
public void getFileSystem1() throws IOException {
//System.setProperty("hadoop.home.dir", "/Users/sunhao/hadoop/hadoop-2.7.5"); 添加这行代码可以通过测试
Configuration configuration = new Configuration();
//指定我们使用的文件系统类型:
configuration.set("fs.defaultFS", "hdfs://node1:8020/");
//获取指定的文件系统
FileSystem fileSystem = FileSystem.get(configuration);
System.out.println("=============="+fileSystem.toString());
}
```
hadoop_home 的定义没有定义,这里要设置为 hadoop 的根目录