What is the difference between JDK and JRE?

Source: Internet
Author: User

http://zhidao.baidu.com/link?url=bdqbxJMbGctI-eXmYfQ4_ A9nrye7p5g7p45ekmtnbmwyw0pgy6k6ezlsui6oukb3eymqald2jiigmbcxfesruaWhat is the difference between JDK and JRE? Share | 2008-06-04 09:51 Talent Boss | browse 127,896 times
What is the connection to their installation directory? Thank you
Report | 2008-06-04 09:53#2016 year high quality new standard full upgrade! #The questioner is adopted by






The JRE is like a PC, and our WIN32 application requires the operating system to run it, and the Java program we write must also have the JRE to run. So when you're done with the JDK, if you install two sets of two different places on your hard drive,
JRE, then you can imagine that your computer has two virtual Java PCs, all with the ability to run Java programs. So we can say that if you have a JRE installed on your computer, you can run the JAV a application correctly.

1. Why does Sun want to have the JDK install two identical JRE? This is because the JDK has a lot of Java-written development tools (such as Javac.exe, Jar.exe, etc.), and is placed in the \lib\tools.jar. As can be seen from the following example, first renamed Tools.jar to Tools1.jar, and then run Javac.exe, showing the following result: Exception in thread "main" Java.lang.NoClassDefFoundError: Com/sun/tools/javac/main This means that your input javac.exe is the same as the input JAVA-CP C:\jdk\lib\tools.jar Com.sun.tools.javac.Main and will get the same result. From here we can prove that Javac.exe is just a wrapper (Wrapper), and the purpose of the production is to keep the developer from entering too long a finger. And can find the \lib directory of the program is very small, not more than 2 9K, from here we can draw a conclusion. Is that the tool in the JDK is almost written in Java, so it is also a Java application, so to use the tools attached to the JDK to develop Java programs, you must also attach a set of JRE, so it is located in C:\Program files\ The JRE in the Java directory is used to run generic Java programs.

2, if a computer installed more than two sets of JRE, who will decide? The big task falls on Java.exe. Java.exe's job is to find the right JRE to run Java programs. Java.exe the JRE according to the following order: There is no JRE in its own directory; the parent directory has no JRE; query registry: [Hkey_local_machine\software\javasoft\java Runtime Environment] So Java.exe's running results have a lot to do with which JRE in your computer is being executed.

3. The bin directory under the JVM JRE directory has two directories: server and client. This is where the real jvm.dll lies. Jvm.dll cannot work alone, and when Jvm.dll is started, it uses the explicit method (that is, using LoadLibrary () and GetProcAddress () in the Win32 API to load the auxiliary dynamic-link library). These auxiliary dynamic link libraries (. dll) must be in the parent directory of the directory where the Jvm.dll resides. So which JVM you want to use, just set path and point to the Jvm.dll under the directory where the JRE resides.

What is the difference between JDK and JRE?

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.