What Does Sudo Ln -Sfn Do?

What Does Sudo Ln -Sfn Do?

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"

1 Answer

ln is the command creating the links between files, here is man page.

ln -sfn means force creating a new symlink.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Alexander Ross
Author

Alexander Ross

Alexander Ross has covered the video game industry for a decade, writing deep dives on game design, esports tournaments, VR developments, and gaming culture.