The difference between JDK,JRE and JVM in Java

Source: Internet
Author: User
Tags java se

The JDK (Java development Kit) is the product for Java developers and is the core of the entire Java, including the Java Runtime Environment JRE, Java tools, and Java base class libraries. Java Runtime Environment (JRE) is a collection of environments necessary to run Java programs, including the JVM standard implementation and the Java Core Class library. The JVM is the abbreviation for Java Virtual machine (Java VM), the most central part of the entire Java implementation cross-platform, capable of running software programs written in the Java language. Although they look similar, they are different products for specific purposes.

Java Development Kit (JDK)

The Java SDK is the core component of the Java environment and provides all the tools, executables, and binaries required to compile, debug, and run a Java program. The JDK is a platform-specific software that has different installation packages for Windows,mac and Unix systems. It can be said that the JDK is a superset of the JRE, which contains the Java compiler for the JRE, the debugger, and the core class. The current JDK version number is 1.8, also known as Java 8.

The JDK contains the JRE, in the JDK installation directory, there is a directory named JRE, there are two folders Bin and Lib, where it can be considered that the bin is the jvm,lib in the JVM is required to work the class library, and the JVM and Lib are called the JRE.

The JDK is the core of the entire Java, including the Java Runtime Environment JRE (Java Runtime envirnment), a stack of Java tools (JAVAC/JAVA/JDB, etc.), and a Java-based class library (that is, the Java API includes Rt.jar). Pyramid structure: jdk=jre+jvm+ other. Running Java programs generally requires the user's computer to install the JRE environment (Java Runtime Environment); No Jre,java programs will work, and without Java programs, the JRE will be useless.

Several versions of the JDK:

①se (J2SE), Standard Edition, is a version we typically use, starting with JDK 5.0 and renaming Java SE.

②ee (EE), Enterprise Edition, Corporate Edition, uses this JDK to develop the Java EE application, starting with JDK 5.0, and renaming it to the JavaScript.

③me (J2ME), Micro Edition, is primarily used for Java applications on mobile devices and embedded devices, starting with JDK 5.0 and renaming Java ME.

Java Runtime Environment (JRE)

JRE, which is what we call the Java platform, all Java programs must be run under the JRE. Includes JVM and Java core class libraries and support files. It does not include development tools-compilers, debuggers, and other tools-compared to the JDK. The JRE is the implementation of the JVM, which provides a platform for running Java programs. The JRE contains the JVM, Java binaries, and other class files that successfully execute the program.

Unlike the familiar JDK, the JRE is a running environment that is indispensable for running programs written in the Java language, not a development environment, so it does not contain any development tools (such as compilers and debuggers), but only for users who use Java programs, Java developers have been able to publish their own programs to the user's hands, to let users use. If you just want to execute a Java program, you only need to install the JRE, without the need to install the JDK.

Java virtual Machine (JVM)

The JVM is the core part of the entire Java implementation cross-platform, the JVM has its own perfect hardware architecture, such as processor, stack, register, etc., also has the corresponding instruction system. The main task of the JVM is to interpret its own instruction set (that is, bytecode) and map it to the local CPU's instruction set or system call to the OS. When we run a program, the JVM is responsible for converting bytecode to specific machine code. The JVM is platform-specific and provides core Java methods, such as memory management, garbage collection, and security mechanisms. The JVM is customizable, and we can customize it with Java options, such as configuring the upper and lower bounds of JVM memory. The JVM is called virtual because it provides an interface that does not depend on the underlying operating system and machine hardware. This hardware-and OS-independent feature is why Java programs can write multiple executions at once.

The Java language is a cross-platform operation, in fact, different operating systems, using different JVM mapping rules, so that it is independent of the operating system, the completion of cross-platform. The JVM masks information that is relevant to the operating system platform, allowing Java programs to run without modification on multiple platforms by generating only the target code (bytecode) that runs on the Java virtual machine. The JVM does not care about the upper Java source files, it only focuses on the class file generated by the source file. The composition of the class file includes the JVM instruction set, the symbol table, and some subsidy information.

The difference between JDK, JRE, and JVM

①JDK is used for development, and the JRE is used to run Java programs.

Both the ②JDK and the JRE contain the JVM, which allows us to run Java programs.

③JVM is the core of the Java programming language and has platform independence.

In Java development: After we developed our own Java program using the JDK (calling the Java API), we compiled our text Java files into Java bytecode using the compiler program in the JDK (Javac), and ran the Java bytecode on the JRE. The JVM parses these bytecode and maps it to a CPU instruction set or system call to the OS.

The difference between JDK,JRE and JVM in Java

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.