Article directory
HomeBrew replaces domestic mirror sources
Enter the following command into the terminal to switch brew / brew-core / brew-cask to the source of the University of Science and Technology of China
cd "$(brew --repo)" && git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core" && git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-cask" && git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git
echo 'export HOMEBREW_BOTTLE_domAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.zshrc
source ~/.zshrc
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile
source ~/.zshrc
brew update
Installation and use of Java11 version
Install Java11
After confirming that brew is installed, enter the terminal to execute
brew install --cask openjdk@11
View existing Java versions
Get instructions with this command
/usr/libexec/java_home -V
Make a note of your java version path
/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home
Switch Java version
Note⚠️ If you are creating a configuration for the first time, you can use this command to create a configuration file~
touch .bash_profile
Or use the following command to open the configuration file.
open -e .bash_profile
Here you need to copy the above path.
export JAVA_HOME=`/Library/Java/JavaVirtualMachines/adoptopenjdk-13.jdk/Contents/Home`
export CLASS_PATH="$JAVA_HOME/lib"
Finally, use source .bash_profile
the command to complete the configuration.