I am using M1 Mac OS11.5.2.
I've already downloaded zulu.jdk and zulu.jre, in "/Library/Java/JavaVirtualMachines".
I also exported the PATH.
echo export "JAVA_HOME=\$(/usr/libexec/java_home)" >> ~/.bash_profile
When I type
sudo apt update
I get this:
The operation couldn’t be completed. Unable to locate a Java Runtime that supports apt.
Please visit http://www.java.com for information on installing Java.
I hope some kind person could tell me the solution.
APT is for Linux, not macOS. Similarly, BSD has their own tools in Packages and Ports.
You can add a similar package-management tool to macOS developed by a third party: Homebrew.
I have not used Homebrew myself, but some folks are big fans.
To install Java, I use an installer app for macOS from Adoptium or Azul Systems, or from any of the several other vendors providing distributions of Java such as BellSoft, Amazon, Microsoft, Oracle, SAP, Red Hat/IBM, Pivotal, etc.
To update I simply:
/Library/Java/JavaVirtualMachines.This approach is a manual operation. And this requires the Mac’s admin password.
So for mass updates across many computers I can imagine that shell-scripting with Homebrew would be a better solution. If you’d rather not install Homebrew, some vendors are releasing installers that can controlled by a shell script.