Skip to Main Content
Install Database Objects Item and JavaScript Examples

Install Java JDK11 on MacOS

The blueprint presented below outlines the required steps to install Java JDK 11 on macOS.

HomeBrew to Install Java JDK11 on MacOS

The blueprint presented below outlines the required steps to install Java JDK 11 on macOS. Installation of JDK 11 is mandatory for running SQLcl version 25.2.2. The documented execution steps were successfully validated on a MacBook Air (M4, 2025), ensuring both accuracy and platform compatibility.

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Run these commands in your terminal to add Homebrew to your PATH:

echo >> /Users/$USER/.zshrc
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/$USER/.zshrc
eval "$(/opt/homebrew/bin/brew shellenv)"
brew update
brew install java11

For the system Java wrappers to find this JDK, symlink it with

sudo ln -sfn /opt/homebrew/opt/openjdk@11/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-11.jdk

If you need to have openjdk@11 first in your PATH, run:

echo 'export PATH="/opt/homebrew/opt/openjdk@11/bin:$PATH"' >> ~/.zshrc

For compilers to find openjdk@11 you may need to set:

export CPPFLAGS="-I/opt/homebrew/opt/openjdk@11/include"
java --version