What is JDK and JRE?

Source: Internet
Author: User

JDK (Java Development kits) is a Java development kit that contains JRE;
JRE (Java Runtime Environment) is the Java Runtime Library and runtime environment.

  Differences between JDK and JRE

JVM is what we often call a Java virtual machine. It is the core of cross-platform JAVA Implementation. All Java programs are first compiled. class files, which can be executed on virtual machines. That is to say, the class does not directly correspond to the operating system of the machine, but indirectly interacts with the operating system through the Virtual Machine, the Virtual Machine interprets the program to the local system for execution. However, the JVM cannot be executed as a class, because the JVM needs to call the library lib required for explanation when interpreting the class. In the JDK installation directory, you can find the JRE Directory, which contains two folders bin and Lib. Here we can think that the bin contains JVM, And the Lib is the class library required for JVM work, JVM and Lib are called JRE. Therefore, after you compile the Java program into a. Class file, you can package the. Class file with JRE and send it to others so that others can run your program. (Jrehas java.exe running .class) to draw a conclusion.JRE is a runtime environment. JRE is required to run Java programs.

JDK is a development environment. Therefore, JDK is required for writing Java programs, and JDK already contains JRE. Therefore, Java programs can run normally when java_home is set as the JDK path.

JDK contains four major parts:
Bin: Compile the compiler (javac.exe compiles. Java into A. Class file)
Include: header file for Java and JVM Interaction
Lib: class library used for Java and JVM Interaction
JRE: Java Runtime Environment (java.exe runs the. Class file)

But I have doubts when I use eclipse. Why can this development environment run normally only with JRE? In fact, the Java compiler is embedded in eclipse and is fully compatible with javac in JDK. Therefore, you can directly compile Java programs without using JDK.

I didn't understand why Tomcat and apusic can be started with JRE, and WebLogic can be started with JDK? The reason is that both Tomcat and apusic 4 have included a source code compiler, while WebLogic does not include this compiler package.

So why do we need a compiler? In Web applications, JSP files need to be converted to servlets. This Servlet File also needs to be compiled into class files that can be executed on JRE. Therefore, JDK with compilation capability must be provided, set java_home to the JDK path.

What about the new apusic 5.0? In order to allow you to flexibly adjust the JVM version, this version does not provide the built-in Java compiler, but uses the JDK installed by the user to compile the JSP, this is why apusic 5.0 must be started through JDK.

Permanent link to this article: http://www.hack0573.com/Program/39.html

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.