4 ms·
The instructions change a bit over time, with macOS upgrades and changes re: brew itself, but in my experience brew has a superb track record of making sure the
by michaelsbradley 3y ago
The instructions change a bit over time, with macOS upgrades and changes re: brew itself, but in my experience brew has a superb track record of making sure the `brew info` instructions are an exact match for what you need to do for your setup.
One macOS Sonoma 14.1.1 just now:
$ brew info java
...
For the system Java wrappers to find this JDK, symlink it with
sudo ln -sfn /usr/local/opt/openjdk/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk
openjdk is keg-only, which means it was not symlinked into /usr/local,
because macOS provides similar software and installing this software in
parallel can cause all kinds of trouble.
If you need to have openjdk first in your PATH, run:
echo 'export PATH="/usr/local/opt/openjdk/bin:$PATH"' >> /Users/[username]/.bash_profile
For compilers to find openjdk you may need to set:
export CPPFLAGS="-I/usr/local/opt/openjdk/include"
...