Java foundation - JDK and JRE What is the difference

to sum up

JRE (Java Runtime Environment), is the Java runtime environment, including virtual machine JVM (java.exe etc.) and basic libraries (rt.jar, etc.).

JDK (Java Development Kit), can be viewed as a superset of the JRE, also includes a compiler (javac.exe), monitoring tools jconsole, analysis tools jvisualvm, other development tools (javadoc.exe, jar.exe, keytool. exe), and more libraries (e.g., the tools.jar) and the like.

 

detail


I am sure when you install the JDK will choose whether to install a separate jre, usually installed together, I suggest that you do so. Because so better to help you figure out the difference between them:

Jre is java runtime environment, a runtime environment java program. Since it is run, of course, include jvm, is familiar virtual machine friends, and all the java library class files are packaged into jar in the lib directory. You can verify yourself. As virtual machines on windows Which documents? MFC learned all know what dll file it, then we take a look at jre / bin / client which is not a jvm.dll it? That is the virtual machine.

Jdk is java development kit, is a java development kit, which contains a variety of libraries and tools. Of course also includes another Jre. So why include another Jre it? And jdk / jre / bin client and server at the same time there are two folders contain a jvm.dll. There is a description of two virtual machines. This I do not know if you noticed it?

I believe we all know that there are a variety of command under bin jdk java programs need to use the jre bin directory with the most obvious difference is only under jdk javac, it is well understood, because jre just a runtime environment only. Nothing to do with development, and as such, has prepared development function under the jdk jre will also have their own jvm jvm server and client nature of nature, but merely as jvm.dll under jre operating environment of the nature of the client only needs enough a.

Remember to set jdk / bin path environment variable path in it? This is the first step we should learn Java, the teacher will tell you not set, then javac and java is not take. Indeed jdk / bin directory contains all commands. But has anyone thoughtWe use the java command but not under jre under jdk / bin directory / bin directory it? Do not believe you can do an experiment, you can cut the java.exe under the jdk / bin directory to somewhere else and then run java program, to find anything? Everything OK!

Someone is bound to ask? I obviously do not set jre / bin directory to environment variable ah?

Imagine if java in order to provide most people use, they do not need jdk development, just let jre java program up and running on it, so each customer need to manually set the environment variable much trouble ah? So jre installed when you install the program automatically help add to the java.exe jre of system variables, verification method is very simple, we see the path the top of the system environment variables are "% SystemRoot% system32;% SystemRoot %;" such a configuration, then go to Windows / system32 below go and see what was found? There is a java.exe.

If you can force the jdk / bin moved to the front of the system32 variables, of course, it can also be forced to use jdk / jre inside java, but unless it is necessary, I do not suggest that you do so. Use separate jre run java program can be considered for testing in customer environments.

Guess you like

Origin www.cnblogs.com/frankcui/p/11743719.html