I'm on macOS monterrey and using a custom JDK 15 (I have to use a custom JDK modified for my company). When I run /usr/libexec/java_home
I get this error:
The operation couldn’t be completed. Unable to locate a Java Runtime.
Please visit http://www.java.com for information on installing Java.
however when I run echo $JAVA_HOME
I get /Library/Java/JavaVirtualMachines/openjdk_15.0.6_15.38.18_x64
. In addition running java --version
return the correct JDK version.
Because /usr/libexec/java_home
doesn't point to the actual JDK directory tools which use Java don't work.
Is there a way to set /usr/libexec/java_home
to point to my JDK directory?