报错:Java.lang.Error: Properties init: Could not determine current working directory.
[root@localhost current]# hadoop fs -ls /
shell-init: 获取当前目录时出错: getcwd: 无法访问父目录: 没有那个文件或目录
chdir: 获取当前目录时出错: getcwd: 无法访问父目录: 没有那个文件或目录
chdir: 获取当前目录时出错: getcwd: 无法访问父目录: 没有那个文件或目录
chdir: 获取当前目录时出错: getcwd: 无法访问父目录: 没有那个文件或目录
Error occurred during initialization of VM
java.lang.Error: Properties init: Could not determine current working directory.
at java.lang.System.initProperties(Native Method)
at java.lang.System.initializeSystemClass(System.java:1166)
该错误表示 getcwd 命令无法定位到当前工作目录。一般来说是因为你 cd 到了某个目录之后 rm 了这个目录,这时去执行某些 service 脚本的时候就会报 getcwd 错误。只需要 cd 到任何一个实际存在的目录下再执行命令即可。
本文详细解析了在Hadoop环境下遇到的“getcwd”命令无法定位当前工作目录的问题,通常这一问题发生在用户在删除所在目录后尝试执行服务脚本时。文章提供了简单有效的解决方案,只需切换到一个存在的目录即可避免此错误。





