macOS: The operation couldn't be completed. Unable to locate a Java Runtime. Please visit http://www.java.com for information on installing Java
macOS has no JDK installed (or the installed one isn't registered), so the java stub fails.
Unable to locate a Java RuntimeThe operation couldn't be completed. Unable to locate a Java RuntimeNo Java runtime present, requesting installUnable to locate a Java Runtime. Please visit http://www.java.com for information on installing JavaJAVA_HOME is not set and no 'java' command could be found macOS Meaning
Install a JDK (brew install openjdk@21 or Temurin) and link it: sudo ln -sfn $(brew --prefix openjdk@21)/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-21.jdk. Set JAVA_HOME with /usr/libexec/java_home -v 21. /usr/bin/java is only a stub that finds JDKs under /Library/Java/JavaVirtualMachines.
Common causes
- No JDK installed
- Homebrew OpenJDK not symlinked into JavaVirtualMachines
- JAVA_HOME pointing to a removed JDK
- Wrong architecture JDK
- PATH missing brew openjdk
⚡ Quick fix
brew install --cask temurinorbrew install openjdk@21+ the symlinkexport JAVA_HOME=$(/usr/libexec/java_home -v 21)- Verify:
java -version
Detailed fix by platform
macOS
/usr/libexec/java_home -Vlists registered JDKs
How to diagnose
- JDK — Installed?
- Registered — java_home lists it?
- JAVA_HOME — Valid?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- Homebrew Cask: It seems there is already an App at Homebrew: Error: It seems there is already an App at '/Applications/Chrome.app'
- Homebrew: No available formula with the name Homebrew: Error: No available formula with the name "x". Did you mean ...?
- Homebrew: Permission denied @ dir_s_mkdir Homebrew: Error: Permission denied @ dir_s_mkdir - /usr/local/Cellar / /opt/homebrew is not writable
Most viewed in macOS
- is damaged and can’t be opened macOS: “App” is damaged and can’t be opened. You should move it to the Trash.
- Operation not permitted (macOS privacy) macOS: Operation not permitted — Terminal/app lacks Full Disk Access (TCC privacy protection)
- git: 'credential-osxkeychain' is not a git command Git: git: 'credential-osxkeychain' is not a git command. See 'git --help'
Other ways to find it
Where this error sits
Origin: Platform & cloud. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 5 Nov 2026