I installed JDK on my mac for Android studios (which I have done before) and I used Homebrew to install. At completion I got these suggestions? I would like to know if I want system Java wrappers to find JDK, Should I symlink it? and Why would I want it first in my path? Also I am using .zshrc as it is now default Catalina and wondering if I set $PATH variables the same way?
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 it shadows the macOS `java` wrapper.
If you need to have openjdk first in your PATH run:
echo 'export PATH="/usr/local/opt/openjdk/bin:$PATH"' >> ~/.zshrc
For compilers to find openjdk you may need to set:
export CPPFLAGS="-I/usr/local/opt/openjdk/include"```
ln
is the command creating the links between files, here is man page .
ln -sfn
means force creating a new symlink.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.