Java 简明教程

Difference Between JDK, JRE, and JVM

JDK、JRE 和 JVM 这三个都是相互依赖的。JDK 主要是面向开发人员来开发基于 Java 的应用程序的 Java Development Kit。JRE 是运行 Java 程序的 Java Runtime Environment。JDK 把 JRE 作为一个组成部分。JRE 也可以在一些不需要进行开发,只是需要运行基于 Java 的应用程序或执行 Java 程序的系统上单独安装。JVM 是一个规范,只要遵守规范,就可以有不同的实现。该规范可以在以下链接中找到: https://docs.oracle.com。JRE 是 JVM 的一个实现。

All three JDK, JRE and JVM are interdependent. JDK is Java Development Kit primarily meant for Developers to develop Java based applications. JRE is Java Runtime Environment where Java program runs. JDK carries JRE as an integral part of it. JRE can be installed seperately as well on systems where no developement is to be done and we only need to run the Java based application or a java program is to be executed. The JVM is a specification, and can have different implementations, as long as they adhere to the specs. The specs can be found in the below link − https://docs.oracle.com. JRE is an implementation of the JVM.

What is JDK?

JDKJava Development Kit 的缩写,其中包括编译、调试和执行 Java 程序所需的所有工具、可执行文件和二进制文件。JDK 依赖于平台,即针对 Windows、Mac 和 Unix 系统有单独的安装程序。JDK 包含 JVM 和 JRE,并且完全负责代码执行。它是表示 version of Java 的 JDK 的版本。

JDK is an abbreviation for Java Development Kit which includes all the tools, executables, and binaries required to compile, debug, and execute a Java Program.JDK is platform dependent i.e. there are separate installers for Windows, Mac, and Unix systems. JDK includes both JVM and JRE and is entirely responsible for code execution. It is the version of JDK that represents a version of Java.

What is JRE?

JREJava Runtime Environment ,它是 JVM 的实现,即实现 JVM 中定义的规范并为代码执行创建相应的环境。 JRE 主要包含 Java 二进制文件和其他类来执行程序,如物理存在的 JVM。除了 Java 二进制文件,JRE 还包含各种部署技术、用于与已执行代码交互的用户界面、用于不同功能的一些基本库以及语言和 util-based libraries

JRE is a Java Runtime Environment which is the implementation of JVM i.e. the specifications that are defined in JVM are implemented and create a corresponding environment for the execution of code. JRE comprises mainly Java binaries and other classes to execute the program like JVM which physically exists. Along with Java binaries JRE also consists of various technologies of deployment, user interfaces to interact with code executed, some base libraries for different functionalities, and language and util-based libraries.

What is JVM?

JVMJava Virtual Machine 的简称,是一个规范,提供了一个可以在其中执行 Java 字节码的运行时环境。它本身是抽象的,它的实现与选择的算法无关,并且是由 Sun 和其他公司提供的。JVM 负责将字节码转换为特定于机器的代码。它还可以运行用其他语言编写并编译为 Java 字节码的程序。JVM 执行以下任务:加载代码、验证代码、执行代码和提供运行时环境。

JVM is the abbreviation for Java Virtual Machine which is a specification that provides a runtime environment in which Java byte code can be executed i.e. it is something that is abstract and its implementation is independent of choosing the algorithm and has been provided by Sun and other companies. It is JVM which is responsible for converting Byte code to machine-specific code. It can also run those programs which are written in other languages and compiled to Java bytecode. The JVM performs the mentioned tasks: Loads code, Verifies code, Executes code, and Provides runtime environment.

Difference between JDK, JRE, and JVM

以下是 JDK、JRE 和 JVM 之间的重要区别:

Following are the important differences between JDK, JRE, and JVM −

Sr. No.

Key

JDK

JRE

JVM

1

Definition

JDK (Java Development Kit) is a software development kit to develop applications in Java. In addition to JRE, JDK also contains number of development tools (compilers, JavaDoc, Java Debugger etc.).

JRE (Java Runtime Environment) is the implementation of JVM and is defined as a software package that provides Java class libraries, along with Java Virtual Machine (JVM), and other components to run applications written in Java programming.

JVM (Java Virtual Machine) is an abstract machine that is platform-dependent and has three notions as a specification, a document that describes requirement of JVM implementation, implementation, a computer program that meets JVM requirements, and instance, an implementation that executes Java byte code provides a runtime environment for executing Java byte code.

2

Prime functionality

JDK is primarily used for code execution and has prime functionality of development.

On other hand JRE is majorly responsible for creating environment for code execution.

JVM on other hand specifies all the implementations and responsible to provide these implementations to JRE.

3

Platform Independence

JDK is platform dependent i.e for different platforms different JDK required.

Like of JDK JRE is also platform dependent.

JVM is platform independent.

4

Tools

As JDK is responsible for prime development so it contains tools for developing, debugging and monitoring java application.

On other hand JRE does not contain tools such as compiler or debugger etc. Rather it contains class libraries and other supporting files that JVM requires to run the program.

JVM does not include software development tools.

5

Implementation

JDK = Java Runtime Environment (JRE) + Development tools

JRE = Java Virtual Machine (JVM) + Libraries to run the application

JVM = Only Runtime environment for executing the Java byte code.