JDK Introduction
What is JDK
JDK Java Development Kit is an abbreviation, meaning Java Development Kit. JDK like heart Zuoren, who no heart, life will be lost meaning of existence. Java, too, JDK is its heart, is its core. JDK not only have the Java Runtime Environment (Java Runtime Environment), as well as Java tools and Java core class libraries (JavaAPI). Whatever the substance of Java application servers have built a version of the JDK.
In addition, the JavaSE API subset JavaAPI class library and the Java Virtual Machine (JVM) two parts collectively referred to as JRE (Java Runtime Environment), JRE supports standard Java environment to run.
In other words, JDK is the Java development environment, Java JRE is the runtime environment. JDK is required at the time of writing Java programs, and time running Java programs require JRE. JDK installation package which will contain JRE, and therefore only need to download and install the JDK, you can edit the Java program, the Java program can run normally. However, due to JDK it contains many unrelated content and operation, the space occupied by the larger, so running ordinary Java programs can also install only JRE, do not install the JDK.
Relations JDK, JRE, JVM's
JDK (Java Development Kit - Java Virtual Machine)
JRE (Java Runtime Environment - Java Runtime Environment)
JVM (Java Virtual Machine - Java Virtual Machine)
JDK installation package which contains a JRE, which in turn contains the JRE JVM. It is equivalent to the installation JDK installed JDK + + the JRE the JVM.
Download and install the JDK
Since Java was acquired by Oracle (Oracle) company, JDK release and update Oracle also comes down to the name, so we have to be downloaded from the Oracle official website.
Download: https://www.oracle.com/technetwork/java/javase/downloads/index.html
(There are many versions, we can choose according to their own need to download version, here I am to JDK8 for example)
Download time remember to click Accept License Agreement diagram arrow (accept the license agreement), and then select the corresponding system click the little red arrow below Download.
Installation steps generally only need to agree to the policy, click on the next step to be all right.
Java Runtime Environment Configuration
Here's operating environment does not mean JRE, but our computer system to be configured environment (can be understood as configuration environment variable).
We need to configure three environment variables Java:
JAVA_HOME: JDK installation path installed configuration package the JDK
PATH: JDK bin path configuration package.
Location of the configuration file library: CLASSPATH
Here to Windows10 system as an example:
Find the "This computer" on the desktop, right-click and select "Properties" to open as shown below, click on the arrow "Advanced System Settings."
Select the "Environment Variables" We will open the configuration interface of the system environment
After opening we could see was divided in two parts, we like to configure user variables
Click New, and then enter the variable name: JAVA_HOME
Input variable values: JDK installation path (if the installation is not selected default path is the path: C drive Program Files folder)
Select the Java folder
Click to copy down the path into the JDK to fill in variable values
Click OK when filled out, so that the JAVA_HOME variable is set up
Because the default system PATH variable there, we do not need new, find PATH click Edit, then click New
Then fill in the JDK bin path into
Finally, we left the CLASSPATH environment variable, CLASSPATH system environment variable is not, like JAVA_HOME environment variables, we need to create
Enter the variable name: CLASSPATH
Variable value: the installation path of the JDK lib
In this way the Java Runtime Environment are done!
接下来测试一下环境变量是否配置成功:
键盘选择Win+R键打开,输入:cmd
然后按回车键打开Dos命令窗口,输入:java,按回车键,如下所示
再输入:javac,按回车键,如下所示
最后再输入:java -version,按回车键,如下所示
如果测试结果都与以上三幅图中结果一样则表示安装并且配置均无误
否则就看看是不是环境变量没有配置好