First step: Download the JDK
Address: http://www.oracle.com/technetwork/java/javase/downloads/index-jsp-138363.html, (the site is Oracle because Sun was acquired by Oracle in 2009)
Click the Java Download button.
Select the "Accept License Agreement" radio button.
Take the Windows 64-bit operating system as an example to download the JDK for Windows version X64.
Click "Jdk-8u5-windows-x64.exe" to download directly.
Step Two: Install
Double-click Run installation
Click the Next button.
Click the "Change" button to select the installation directory for the JDK. (Personal advice not to modify)
Click "Next" button to install ...
Click the "Change" button to select the installation directory for the JRE. (Personal advice not to modify)
Click "Next" button to install ...
Installation is complete.
Attached: JDK directory structure:
Jdk\bin\ |
Includes compilers, interpreters, and some basic tools |
Jdk\include\ |
is the WIN32 subdirectory, including the local method file |
Jdk\jre |
is the root directory of the Java Program Runtime Environment |
Jdk\jre\bin |
Executable and dynamic-link library files for tools and class libraries, including platform runtime |
Jdk\jre\lib |
Includes code base for Java runtime, default installation files, etc. |
Jdk\lib |
Include Class library files |
Jdk\src.zip |
Source Code Compressed files |
Step three: Set up
Defined:
An environment variable is an object with a specific name that contains the information that one or more applications will use.
For example, path, when the system is required to run a program without telling it the full path of the program, in addition to the current directory under the search for this program, but also to the path specified in the paths to find. The user can run the process better by setting the environment variables.
Right-click My Computer and click the Properties option.
Click the Advanced system Settings option.
Select the Advanced tab. Click the Environment Variables button.
Click the New button.
Note: System environment variables work for all users, and user environment variables only work for the current user.
Fill in the variable name and the variable value.
(1) Java_home
is the path to the JDK in the Java installation path. (Ensure that software such as JCreator, Eclipse, and MyEclipse works properly)
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) Java Interpreter (Java.exe), in order to be able to use compilers and interpreters in any directory, set path in the system features.
Example: C:\Program files\java\jdk1.8.0_05\bin
or write%java_home%\bin (where "%java_home%" is the path to the JDK you just set. And when the path of the JDK changes, there is no need to change it here)
Note : If there are multiple variable values, use ";" Separate (not including quotation marks)
(3) CLASSPATH
The Lib folder in the JDK installation path contains the Java class library files required to run the Java application.
For example:.; C:\Program Files (x86) \java\jdk1.7.0_03\lib
or written.; %java_home%\lib ("%java_home%" means ibid.) )
Note : Be sure to add ".;" At the beginning (not including quotation marks)
Press the key combination "Win" + "R", bring up the Run window, enter CMD in the "Open" text box, click the OK button.
Pop-up the command prompt interface, enter Java at the cursor, and enter.
After entering "Java", enter (or Javac), if there is help information showing Java, the environment variable setting is successful.
Appendix
Main programs in the JDK:
Javac |
Java compiler, Convert Java source code to bytecode. |
Java |
Java interpreter, Executes the Java application bytecode directly from the class file. |
Appletviewer |
Applet browser, A Java browser that executes a Java applet on an HTML file. |
Javadoc |
Generate HTML documents based on Java source code and description statements. |
Jdb |
Java debugger, you can execute the program row by line , set breakpoints, and check variables. |
Javah |
Generates a C procedure that can invoke a Java procedure, or a header file that can be called by a Java program. |
Javap |
Java disassembler, Displays the accessible features and data in the compiled class file, along with the meaning of the byte code. |
Development environment is complete!!
Diagram of the Java operating environment construction process under WINDOWS7