当前位置:   article > 正文

/bin/java: No such file or directory

/bin/java: No such file or directory

This answer is applicable for Hadoop version 2.6.0 and earlier. Disabling SIP and creating a symbolic link does provide a workaround. A better solution is to fix the hadoop-config.sh so it picks up your JAVA_HOME correctly

In HADOOP_HOME/libexec/hadoop-config.sh look for the if condition below # Attempt to set JAVA_HOME if it is not set

Remove extra parentheses in the export JAVA_HOME lines as below. Change this

  1. if [ -x /usr/libexec/java_home ]; then
  2. export JAVA_HOME=($(/usr/libexec/java_home))
  3. else
  4. export JAVA_HOME=(/Library/Java/Home)
  5. fi

to

  1. if [ -x /usr/libexec/java_home ]; then
  2. // note that the extra parentheses are removed
  3. export JAVA_HOME=$(/usr/libexec/java_home)
  4. else
  5. export JAVA_HOME=/Library/Java/Home
  6. fi

Restart yarn after you have made this change.

More detailed info can be found here https://issues.apache.org/jira/browse/HADOOP-8717 and seems that Hadoop 3.0.0-alpha1 is the first release with the fix.

 

方法二

试了以上几种方法后依然无法解决问题,然后在链接4的评论下又看到一篇文章,说能真正解决这个问题,因为以前遇到过这个问题,依稀记得当时是重启电脑输入什么命令后解决的,然后点进去链接看到文章里果然有我的评论,所以在此仅以此文记录下这个坑,以后再犯好找解决方法

以下是解决方法,参考这里: 
1,重启电脑,进入恢复模式,打开终端 
2,输入以下命令,禁用SIP特性,SIP特性大概是指即使拥有sudo权限也无法修改系统级目录的权限,默认为启用状态

csrutil disable
1
3,重启电脑,进入正常模式,打开终端 
在输入建立java软连接的命令

sudo ln -s /usr/bin/java /bin/java
1
输入系统密码就OK了,到此,此错误成功解决

后续:由于担心disable了csrutil会对系统本身有什么影响,于是打算再次开启,测试流程如下 
先重启电脑,再运行job,第一次失败,提示什么safe mode,第二次成功 
再重启电脑,进入恢复模式,启用csrutil

csrutil enable
1
successfully enabled system integrity protection,please restart the machine for the change to take effect 
1
再重启电脑,再运行job,第一次失败,提示什么safe mode,第二次成功 
至此,得出hadoop环境已经正常。
 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/AllinToyou/article/detail/693741
推荐阅读
相关标签
  

闽ICP备14008679号