At first we are talking about MacOS Big Sur.
Until today I had the folder jdk-16.0.2.jdk with all its content in /Library/Java/JavaVirtualMachines which I downloaded from Oracle at a certain point in time.
It worked fine and java -version
respondeds with the corresponding version and Netbeans worked fine along with Tomcat.
That was my java installation. Downloaded the .tar from Oracle and copy to that folder.
Today I am trying to migrate to openJDK so I did the same. I downloaded "openjdk-17.0.2_macos-aarch64_bin.tar" from java.net. Just the same procedure. Untar the files and copy to /Library/Java/JavaVirtualMachines (And moving the old Java to Desktop.
When I try % java -version
I get:
The operation couldn’t be completed. Unable to locate a Java Runtime.
Please visit http://www.java.com for information on installing Java.
I resist a little to the idea of installing JAVA via homebrew (Which I use for other purposes) since I'd like to have the very same version in my dev environment (My Mac in this case) and in my production environment (Rocky Linux 8).
Any idea?
Thank you very much in advance.
CodePudding user response:
If you have not yet updated your %JAVA_HOME% environment variable, that must be pointed to your new installation. Your installation path looks correct. Here is a thread about setting the environment variable: https://stackoverflow.com/a/65162351/1656012