JDK installation and configuration
1. Download
JDK is provided by ORACLE for free download and use. The official website address is: https://www.oracle.com/index.htm
Generally, Java SE version is just selected, and Java EE is selected for the enterprise version.
Downloaded JDK version (the latest one is currently JDK8u112)
JDK development package and related documentation download
>Check agree to click to download
>Download different versions according to different systems
Windows x86: 32-bit Windows system
Windows x64: 64-bit Windows system
Other similarities
After selecting the appropriate version, click Download
2. Installation
Double-click the downloaded JDK
>Click Next
Select the content you want to install and the directory you want to install
Click Next ( Note: If you want to modify the installed directory, the installed directory cannot have Chinese and spaces)
During the installation process, a window to install JRE will pop up. It is recommended to install it. The installation method is similar to JDK. Click Next.
Installation is completed, click Close
3. Configuration
Environment variables generally refer to some parameters used in the operating system to specify the operating system's operating environment.
For example, when the system is required to run a program without telling it the complete path where the program is located, the system will not only look for the program in the current directory, but also search for the path specified in the path.
Why do you need to configure environment variables?
When compiling a program, you need to use the compilation tool javac, and javac is in the java installation directory. When we call javac in other directories, the system will report an error because javac cannot be found in the current directory. In order to facilitate the future compilation of the program, you do not need to go to the java installation directory to compile every time you compile, so you need to set environment variables.
This computer -> Right-click on the mouse -> Properties -> Advanced System Settings -> Advanced -> Environment Variables (This is an example of Windows 10 x64 system)
Create a new system variable
JAVA_HOME
CLASSPATH
Add it to the environment variable path
The function of %%: dynamically obtains the value of an existing environment variable.
%JAVA _ HOME% represents the installation path of JDK. If the installation path changes, you only need to change the corresponding path in the value of JAVA _ HOME. There are no need to change it in the path every time. There are already many values in the path. If you accidentally delete or change it, some programs in the system will not run normally. In order to avoid such mistakes, %JAVA _ HOME% is used instead of paths that may need to be changed, which is convenient for operation and makes it look clearer.
Note: The semicolon must be a semicolon in English input method.
4. Test
Test whether the configured environment is successful
>Shortcut key Win+R―>Input cmd―>Input java -version―>Enter Enter
Enter javac->Enter
Enter java->Enter
If a phenomenon similar to the above occurs, it means that the environment configuration has been successful.
Hello World
Getting started
Run it
The above is all the content of this article. I hope it will be helpful to everyone's learning and I hope everyone will support Wulin.com more.