As a java engineer, you must master the basic skills of JDK and Maven installation and configuration. Although it is not difficult, you must always keep in mind that after all, changing the development environment requires a deployment machine. It is hereby organized and recorded for emergencies.
1 JDK installation and configuration
1 Download JDK Go
to Oracle official website to download JDK ( https://www.oracle.com/java/technologies/javase-downloads.html )
(Figure-1)
2 Install JDK
When installing JDK, in addition to modifying the installation directory, the others can be installed according to the default [Next].
3 Configure environment variables
Click "Start-This Computer (right click)-More-Properties-Advanced System Settings", click "Environment Variables", see the figure below:
(Figure-2)
(Figure-3)
(Figure-4 )
- Select "System Variables", New -> Variable Name "JAVA_HOME", variable value "C:\Program Files\Java\jdk1.8.0_221" (that is, the installation path of JDK).
(Figure 5) - Edit -> variable name "Path", click "New", then enter "%JAVA_HOME%\bin", click "OK", click "New" again, then enter "%JAVA_HOME%\jre\bin", click Sure.
(Figure-6)
(Figure-7)
3) New -> variable name "CLASSPATH", variable value ".;%JAVA_HOME%\lib;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar".
(Figure-8)
4) Test whether the JDK is installed successfully
After configuring the environment variables, enter cmd to check whether Java is installed correctly. The command to check is java -version
(Figure-9)
. As shown in the figure above, the installation is successful.
5) Test whether jre is installed successfully
. After configuring the environment variables, enter cmd to check whether Java is installed correctly. The command to check is javac -version;
(Figure-9)
As shown in the figure above, the installation is successful.
2 Maven installation and configuration
1 Maven download (https://maven.apache.org/download.cgi)
2 Unzip, install, and configure system variables
a Configure the MAVEN_HOME
system variable: MAVEN_HOME = D:\app\apache-maven-3.8.1. As shown in the picture:
b Add the path
system variable: path = %MAVEN_HOME%\bin, as shown in the figure:
3 Test whether the installation is successful
Run cmd and enter: mvn -version, as shown in the figure, the configuration is successful. As shown in the picture: