JDK, JRE, Javac, and JVM relationships

Source: Internet
Author: User

. Java is the source file suffix for Java, and the code you write needs to be written in a. java file.

The Javac compiler, which reads the Java source code and compiles it into a byte code. After Javac compiled, form. class, which is a bytecode file.

The Java Virtual machine (JVM) runs the. class file to enable the program to run.

1, Jvm--java virtual machine, is what we often say the Java VM, it is the entire Java implementation of the most cross-platform part of the core, All Java programs are first compiled into a. class file, which can be executed on a virtual machine, which means that class does not correspond directly to the machine's operating system, but instead interacts with the operating system indirectly by the virtual machine, which interprets the program to the local system for execution.

2, Jre--java Runtime Environment, refers to the Java operating environment. The JVM cannot be executed as a class, because the JVM needs to invoke the class library lib that is needed to interpret the classes. In the JDK installation directory you can find the JRE directory, there are two folders Bin and Lib, here you can think that the bin is Jvm,lib is the JVM to work the class library, and the JVM and Lib are called the JRE. So, after you've finished compiling the Java program into. class, you can package the. class file with the JRE and send it to your friends so that your friends can run your program. (There are java.exe running. Class in the JRE)

3, Jdk--java Development Kit, is the Java Development Toolkit, basically everyone who learns Java will first install a JDK on the machine, which part does he contain? Let's take a look at the JDK installation directory. Under the directory there are six folders, a SRC class library source code compression package, and several other declaration files. One of the four folders that really worked when running Java was the following: Bin, include, Lib, JRE.

Bin: The main thing is the compiler (Javac.exe)

Include:java header files for interaction with the JVM

LIB: Class Library

Jre:java Operating Environment (note: Here the bin, Lib folder and the bin in the JRE, Lib is different)

Now we can see a relationship where the JDK contains the JRE, and the JRE contains the JVM. In general, the JDK is for the development of Java programs, while the JRE is only capable of running class without compiling.

Other Ides, such as Eclipse, IDE, NetBeans, and so on, have their own compilers instead of the JDK bin directory, so you'll find them only asking you to check the JRE path when installing.

Relationship of JDK, JRE, Javac, and JVM

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.