'Hadoop 3.3.2 streaming /bin/bash: /bin/java No such file or directory

I'm trying to run a sample WordCount example on MapReduce with Hadoop 3.3.2 on mac OS 12.3.1. I installed hadoop via homebrew and it seems to work just fine: everything is listed as it should with jps and I've put the files I need on my hdfs.

However, when I run this script:

/opt/homebrew/Cellar/hadoop/3.3.2/bin/hadoop  jar /opt/homebrew/Cellar/hadoop/3.3.2/bin/hadoop-streaming-3.3.2.jar -mapper "python ./mapper_wc.py"  -reducer "python reducer_wc.py"  -input "./Code/inputs/mobydick.txt"  -output "./Code/output"

where, of course, the files are all defined and stored in the hdfs,

I get the following error:

Container exited with a non-zero exit code 127. Error file: prelaunch.err.
Last 4096 bytes of prelaunch.err :
Last 4096 bytes of stderr :
/bin/bash: /bin/java: No such file or directory

Looking online, the most popular answer seems to hardcode the java_home to hadoop-env, but that did not work for me and I still get this error. What am I doing wrong? I've tried everything.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source