Open the terminal to get the java installation path
Enter in the terminal: /usr/libexec/java_home -V
The address of the intermediate java se8 will be used later
Complete the path in the configuration file
Open the profile open -e .bash_profile
Paste the following template into the bash profile, and replace my jdk address with the address behind the above java se8 and save it
#JAVA
JAVA_HOME= my jdk path
PATH=$JAVA_HOME/bin:$PATH:.
CLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar:.
export JAVA_HOME
export PATH
export CLASSPATH
Effective configuration file
Then go to the terminal and enter: source ~/.bash_profile
Finally, you can enter java -version under each file to check whether it is global
4. Download the IDEA installation package
Installation package link: https://pan.baidu.com/s/1-AcpDelmG0_mb0bzxGWD7Q Extraction code: 2hys
After downloading, click the dmg file to install
5. Enter the activation code
Go to the browser to search for the idea activation code (find a few more and keep trying), paste it into the box below, and click activate