Detailed process of configuring JDK 1.8 on Mac
1. Confirm whether the current system has installed JDK.
Enter the following command in the terminal:
java -version
If the system has already installed JDK, the version information of JDK will be displayed. If JDK is not installed, it needs to be downloaded and installed.
2. Download JDK 1.8
You can download the JDK 1.8 installation package from Oracle's official website at the download address .
3. Install JDK 1.8
Open the downloaded installation package and follow the prompts to install it.
4. Configure environment variables
Enter the following command in the terminal:
open ~/.bash_profile
Add the following to the opened file:
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_291.jdk/Contents/Home
export PATH=$JAVA_HOME/bin:$PATH
Among them, /Library/Java/JavaVirtualMachines/jdk1.8.0_291.jdk/Contents/Home
is the installation path of JDK 1.8, which needs to be modified according to the actual installation path.
Save the file and exit.
5. Make the environment variable take effect
Enter the following command in the terminal:
source ~/.bash_profile
6. Verify that the JDK is configured successfully
Enter the following command in the terminal:
java -version
If the version information of JDK 1.8 is output, it means that the JDK configuration is successful.
At this point, the configuration of JDK 1.8 is complete.