1. Download the installation package: Java Downloads | Oracle
2. Select Windows, select the link behind the x64 installer to download
3. Click the downloaded exe file and press the next step to complete the installation
4. Set environment variables and search for environment variables directly in the search bar
5. Click "Environment Variables" in the lower right corner
6. Select any one to create and click, and set the JAVA_HOME variable as shown in the figure below, where the variable value depends on the installation location where you run the exe file at that time
7. Click path in the same column of JAVA_HOME, select New, and enter
%JAVA_HOME%\bin
8. Check whether the installation is successful, click win+R, enter cmd, and enter in cmd
java -version
If the following figure appears, the installation is successful