Step 1: Download JDK
Address: http://www.oracle.com/technetwork/java/javase/downloads/index.html, (since Sun was acquired by Oracle in 2009, the URL is Oracle’s)
Click the "Java Download" button.
Select the "Accept License Agreement" radio button.
We take the Windows 64-bit operating system as an example and download the Windows X64 version of jdk.
Click "jdk-8u5-windows-x64.exe" to download directly.
Step 2: Installation
Double click to run the installation
Click the "Next" button.
Click the "Change" button to select the jdk installation directory. (Personal recommendation is not to modify it)
Click the "Next" button, installing...
Click the "Change" button to select the jre installation directory. (Personally recommend not to modify it)
Click the "Next" button, installation is in progress...
The installation is complete.
Attached: JDK directory structure:
JDK/bin/ | Includes compiler, interpreter and some basic tools |
JDK/include/ | Is the Win32 subdirectory, including local method files |
JDK/jre | Is the root directory of the Java program running environment |
JDK/jre/bin | Including executable files and dynamic link library files of platform runtime tools and class libraries |
JDK/jre/lib | Including Java runtime environment code library, default installation files, etc. |
JDK/lib | Include class library files |
JDK/src.zip | Source code compressed file |
Step 3: Setup
definition:
An environment variable is an object with a specific name that contains information that will be used by one or more applications.
For example, path, when the system is asked to run a program without telling it the full path where the program is located, the system should not only search for the program in the current directory, but also go to the path specified in path. Users can better run processes by setting environment variables.
Right-click "My Computer" --> click the "Properties" option.
Click on the "Advanced system settings" option.
Check the "Advanced" tab. Click the "Environment Variables" button.
Click the "New" button.
Note: System environment variables affect all users, while user environment variables only affect the current user.
Fill in the variable name and variable value.
(1) JAVA_HOME
It is the path of jdk in the java installation path. (Make sure software such as JCreator, Eclipse and MyEclipse can run normally)
For example: C:/Program Files/Java/jdk1.8.0_05
(2) PATH
The bin folder of the JDK installation directory contains the Java compiler (javac.exe) and the Java interpreter (java.exe). In order to use the compiler and interpreter in any directory, Path should be set in the system properties.
For example: C:/Program Files/Java/jdk1.8.0_05/bin
Or write it as %JAVA_HOME%/bin (where "%JAVA_HOME%" is the path to the JDK you just set. And when the path to the JDK changes, there is no need to change it here)
Note : If there are multiple variable values, separate them with ";" (excluding quotation marks)
(3) CLASSPATH
The lib folder in the JDK installation path contains the Java class library files required for running Java applications.
For example: .;C:/Program Files (x86)/Java/jdk1.7.0_03/lib
Or written as .;%JAVA_HOME%/lib ("%JAVA_HOME%" means the same as above.)
Note : Be sure to add ".;" at the beginning (excluding quotation marks)
Press the key combination "Win" + "R" to bring up the run window, enter cmd in the "Open" text box, and click the OK button.
The command prompt interface pops up, enter java at the cursor, and press Enter.
Enter "java" and press Enter (or javac). If the help message for java is displayed, it means that the environment variable is set successfully.
appendix
Main programs in JDK:
Javac | Java compiler, converts Java source code into bytecode. |
Java | Java interpreter that executes Java application bytecode directly from class files. |
Appletviewer | Applet browser, a Java browser that executes Java applets on HTML files. |
Javadoc | Generate HTML documents based on Java source code and description statements. |
Jdb | Java debugger, which can execute programs line by line, set breakpoints and inspect variables. |
Javah | Generate a C procedure that can call a Java procedure, or create a header file for a C procedure that can be called by a Java program. |
Javap | Java disassembler, showing the accessible functions and data in compiled class files, while showing the byte code meaning. |
The development environment is set up! !