[Notes] mac installs jdk files, configures jdk environment variables

Download the corresponding jdk version in oracle:

oracle official website download

After the download is complete, install the dmg file. After the installation is complete, command+space to bring up the search interface, and enter ter to enter the command line interface:

Check the current jdk version:

java -version

View the location of the current jdk installation and modify the configuration file:

/usr/libexec/java_home -V

insert image description here
Edit configuration file:

vi ~/.bash_profile

Insert the following content and modify the first line according to the current jdk installation location:

#jdk1.8
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_321.jdk/Contents/Home
export PATH=$JAVA_HOME/bin:$PATH:. 

insert image description here

Refresh the configuration:

source ~/.bash_profile

Guess you like

Origin blog.csdn.net/qq_41619841/article/details/123120383