1.download installation package
(macOS version end with .pkg)
download link
2.install jdk11
- open the '.pkg' file
- follow the installation prompts to install
3.configuring environment vaiables
- open the terminal, run the fllowing command to confirm the installation path
/usr/libexec/java_home -v 11
- edit '~/.zshrc' or '~/.bash_profile' file,add the following content
export JAVA_HOME=$(/usr/libexec/java_home -v 11)
export PATH=$JAVA_HOME/bin:$PATH
- save and exit the file, use the following command to make the configuration effective
source ~/.zshrc
or
source ~/.bash_profile
4.verify
- check 'JAVA_HOME' variable
echo $JAVA_HOME
- check java version
java -version
- check javac version
javac -version
Top comments (0)