If you need to quickly switch between Java versions on your Mac, you can use aliases and environment variables directly in your .zshrc file. Follow these steps:
Steps 1. Open your TerminalOpen the Terminal application. You can find and open it by typing “Terminal” in the Spotlight search bar.
2. Edit your .zshrc fileEdit your .zshrc file using a text editor. You can use the nano editor or any other text editor you prefer.