Java Virtual machine for Monterey

I want to install a GitHub repository and nvm command therefore I need the java virtual machine. When I check the "java -version in zsh I always get this Error Error: Could not create the Java Virtual Machine.

What would you suggest since it is installed JavaVirtualMachines/jdk-18.0.1.jdk?

Not sure if your issue is similar. I had openJDK installed through homebrew but the macOS didn't recognize it. Every time I tried to run java it complained that "The operation couldn’t be completed. Unable to locate a Java Runtime. Please visit http://www.java.com for information on installing Java."

For macOS /usr/bin/java wrapper to find the installed JDK, manually create a symbolic link at /Library/Java/JavaVirtualMachines/, like "sudo ln -sfn /opt/homebrew/Cellar/openjdk/18.0.1.1/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk". After that the brew installed jdk was recognized properly.

sudo ln -sfn /opt/homebrew/Cellar/openjdk/21.0.1/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk

Worked for me, thanks!

Java Virtual machine for Monterey
 
 
Q