I am new to macOS. I know this question has been asked a lot before but all mentioned methods are not work for me. I have tried https://www.youtube.com/watch?v=_gdpclEE-kA one also but it displayed an error like no such file or directory.(java version 16.0.1)
Asked
Active
Viewed 1,325 times
2 Answers
0
The default shell for macOS has changed to zsh so you would need to edit either ~/.zshrc
. So, you can do something like this:
echo 'export JAVA_HOME=$(/usr/libexec/java_home)' >> ~/.zshrc
This should work if you have jdk installed

Saad Parwaiz
- 131
- 1
- 4