1. Download jdk1.8
- Official Download (SWPA)
to select the corresponding version agree to the license → → → login to download
- Huawei mirror sites to download (Recommended)
2. Install
- Open the installation package for installation, click Next
- Select the installation path, click Next
- installing. . .
- Next will jump jre installation interface
- In fact, do not install jre also possible, including because jdk jre, you can exit the installation directly.
Explained in detail with reference to https://www.cnblogs.com/gaigaichen/p/6262872.html - Next Dafa direct installation, the installation is successful
3. Set Environment Variables
Generally need to configure three variables: Java_Home, Path, Classpath
- Right-click My Computer → click Properties, then click Advanced System Settings.
- Click Environment Variables
- User variables only works for the current user, the system variable is for all users.
- Variables Description (variable names are not case-sensitive)
-
- JAVA_HOME: jdk represents the installation directory. Easy to modify jdk path, but also some third-party software editors agreed jdk installation path variable name.
-
- Path (original system): When the system is required to run a program, the system and specify the directory to find the next path in the current directory. The following variable specifies the directory needed java compiler program running.
-
- ClassPath: class search path is specified, the use of already written to the class, JVM is through it to find the class. After jdk1.5, no need to configure classpath, jdk automatically search the current directory, dt.jar and tool.jar.
- Configuration environment variable
click New, enter the variable name and value, and then OK.
Modify the Path variable: Find the Path entry click Edit, add the following two values, and then OK.
%JAVA_HOME%\bin
%JAVA_HOME%\jre\bin
Since win7 is displayed in a row, each separated by semicolons paste in the line.
Because it is jdk1.8 version, CLASSPATH do not have to configure, but in some books and tutorials have this configuration, the configuration done no effect. Names and values as shown in FIG.
.;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;
Note that there is a point in front.
4. Test
Command line to run java, javac, java -version to see the effect
javac
java -version
java