What are JDK and JRE? What is the purpose? (Post)

Source: Internet
Author: User
What are JDK and JRE? What is the purpose? (Post)

Article category: Java programming

You must choose whether to install a separate JRE when installing JDK. It is usually installed together. I also recommend that you do this.
This helps you better understand the differences between them:

JRE is the Java Runtime Environment and the execution environment of Java programs. Since it is execution, of course, the JVM should be included, that is, the familiar virtual machine, and all the class files of the Java class library should be packaged into jar in the Lib folder. You can verify it by yourself. Which file is the virtual machine on windows? Anyone who has learned MFC knows what DLL files are. So let's see if there is a JVM. dll in JRE/bin/client? That is, virtual machines.

JDK is a Java development kit and a Java Development Kit, which includes various class libraries and tools. Of course, it also includes another JRE. So why should we include another JRE? In addition, JDK/JRE/bin contains a JVM. dll in both the client and server directories at the same time. There are two virtual machines. I don't know if you have noticed this yet?

I believe everyone knows that JDK's bin contains the commands required by various Java programs. The most obvious difference with the bin folder of JRE is that javac is available under JDK, which is very easy to understand, JRE is only an execution environment. It has nothing to do with development. Because of this, JDK's own JRE with the development function will have a client JVM and a server JVM at the same time, the JRE, which is used only as the execution environment, requires only client JVM. DLL is enough.

Do you remember to set the JDK/bin path in the environment variable path? This should be the first step for everyone to learn java. The teacher will tell everyone that javac and Java will not be used if they are not set. The JDK/bin folder contains all the commands. But has anyone ever wondered whether the Java command we use is not in the JDK/bin folder but in the JRE/bin folder? I don't believe I can do an experiment. You can cut the java.exe folder under the JDK/binfile to another place and then execute the Java program. What did you find? Everything is OK!

So someone will ask? Why didn't I set the JRE/bin folder to the environment variable?

Suppose that Java is not required for JDK development to be provided to most people, and JRE can be used to run Java programs, so every customer needs to manually set environment variables. How troublesome is it? The wait installer for jreinstallation will help you add jre's java.exe to the system variables. The verification method is very easy. You can see that the system environment variable path is prefixed with "% SystemRoot %/system32; % SystemRoot %, so let's go to Windows/system32 or lower to see what we found? There is a java.exe.

If we can forcibly move JDK/bin to the front of the System32 variable, we can also force the use of Java in JDK/JRE, unless necessary, I do not recommend that you do this. Using a separate JRE to run a Java program is also a trial in the customer's environment.

Now, we should be more clear about the internal connections and differences between JDK and JRE?

What are JDK and JRE? What is the purpose? (Post)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.