JDK \ JRE \ JVM 的关系,以及 Open JDK \ Oracle Java SE \ IBM Semeru \ OpenJ9 \ Temurin JDK 之间的关系
如果程序员想使用 Java 命令运行 Java 程序,他们应该安装 JRE。如果他们只是安装(而不开发或编译代码),那么只需要 JRE 即可。
以 IBM 这篇文章为主, https://www.ibm.com/think/topics/jvm-vs-jre-vs-jdk
先说结论
JDK vs. JRE vs. JVM: Key differences
JDK 对比 JRE 对比 JVM:关键区别
JDK is the development platform, while JRE is for execution.
JDK是开发平台,而JRE用于执行。
JVM is the foundation, or the heart of the Java programming language, and ensures the program’s Java source code will be platform-agnostic.
JVM 是 Java 编程语言的基础,或者说核心,它确保了程序的 Java 源代码与平台无关。
JVM is included in both JDK and JRE—Java programs won’t run without it.
JVM同时包含在JDK和JRE中——没有它Java程序将无法运行。

补充技术
There are many complementary technologies that can be used to enhance JVM, JRE, or JDK. The following technologies are among the most frequently used:
有许多互补技术可用于增强JVM、JRE或JDK。以下是最常用的技术之一:
Just-in-time Compiler (JIT) is part of JVM and optimizes the conversion of bytecode to machine code. It selects similar bytecodes to compile at the same time, reducing the overall duration of bytecode to machine code compilation.
即时编译器(JIT)是JVM的一部分,用于优化字节码到机器代码的转换过程。它会选择相似的字节码同时进行编译,从而缩短整体从字节码到机器代码的编译时间。
Javac, another complementary tool, is a compiler that reads Java definitions and converts them into bytecode that can run on JVM.
Javac是另一个配套工具,它是一个编译器,负责读取Java定义并将其转换为能在JVM上运行的字节码。
Javadoc converts API documentation from Java source code to HTML. This is useful when creating standard documentation in HTML.
Javadoc 将 Java 源代码中的 API 文档转换为 HTML 格式。这在创建标准 HTML 文档时非常有用。
JVM and container technology
JVM和容器技术
Java virtual machine (JVM) is used to create—you guessed it—virtual machines (VMs). VMs are servers that allow multiple applications to run on the same underlying physical hardware without impacting one another. This provides better use of resources and makes it much easier and cost-effective to scale than traditional infrastructure. VMs are also easily disposable because of their independence. When you no longer need the application, you simply take down the VM.
Java虚拟机(JVM)——正如您所猜测的——用于创建虚拟机(VM)。虚拟机是允许多个应用程序在同一底层物理硬件上运行而互不影响的服务器。这提供了更好的资源利用率,并且与传统基础设施相比,扩展起来更加容易且成本效益更高。由于虚拟机的独立性,它们也易于处理。当您不再需要某个应用程序时,只需关闭相应的虚拟机即可。
Containers take this abstraction to the next level and virtualize the OS kernel. The absence of the OS renders containers even more lightweight, fast, and flexible than VMs.
容器将这种抽象提升到了一个新的层次,虚拟化了操作系统内核。由于无需运行完整的操作系统,容器比虚拟机更加轻量、快速且灵活。
在正文开始之前,先看一下 Java Docs 6 和 Java Docs 8 对 JDK、JVM、JRE的图示。
Java 6 Docs https://docs.oracle.com/javase/6/docs/

Java 8 Docs https://docs.oracle.com/javase/8/docs/

Description of Java Conceptual Diagram —— https://docs.oracle.com/javase/8/docs/technotes/guides/desc_jdk_structure.html
正文
Java is one of the most popular programming languages that are used in developing environments today. It is primarily used for back-end development projects, game development, and desktop and mobile computing. Read on and find out how Java virtual machine (JVM), Java Runtime Environment (JRE), and Java Development Kit (JDK) each play a role in the Java development process. You'll also learn about their relationship to each other and the differences that set them apart.
Java是当今开发环境中使用最广泛的编程语言之一,主要应用于后端开发项目、游戏开发以及桌面和移动计算领域。继续阅读,了解Java虚拟机(JVM)、Java运行时环境(JRE)和Java开发工具包(JDK)各自在Java开发过程中扮演的角色。您还将了解它们之间的相互关系及彼此区别。
What is Java virtual machine (JVM)?
Java virtual machine, or JVM, loads, verifies, and runs Java bytecode. It is known as the interpreter or the core of the Java programming language because it runs Java programming.
Java虚拟机(JVM)负责加载、验证并运行Java字节码。它被称为Java语言的解释器或核心,因为正是它运行着Java程序。
The role of JVM in Java
JVM is responsible for converting bytecode to machine-specific code and is necessary in both JDK and JRE. It is also platform-dependent and performs many functions, including memory management and security. In addition, JVM can run programs that are written in other programming languages that have been converted to Java bytecode.
JVM负责将字节码转换为机器特定代码,在JDK和JRE中都是必需的。它依赖于平台并执行许多功能,包括内存管理和安全。此外,JVM可以运行由其他编程语言编写并已转换为Java字节码的程序。
Java Native Interface (JNI) is often referred to in connection with JVM. JNI is a programming framework that enables Java code running in JVM to communicate with (that is, to call and be called by) applications that are associated with a piece of hardware and specific operating system platform. These applications are called native applications and can often be written in other languages. Native methods are used to move native code written in other languages into a Java application.
Java本地接口(JNI)常与JVM相关联提及。JNI是一种编程框架,使得运行在JVM中的Java代码能够与特定硬件和操作系统平台相关的应用程序进行交互(即调用或被调用)。这些应用程序被称为本地应用,通常可用其他语言编写。本地方法用于将其他语言编写的原生代码集成到Java应用程序中。
JVM components
JVM consists of three main components or subsystems:
JVM由三个主要组件或子系统组成:
— Class Loader Subsystem is responsible for loading, linking, and initializing a Java class file (that is, “Java file”), otherwise known as dynamic class loading.
类加载器子系统负责加载、链接和初始化Java类文件(即“Java文件”),也称为动态类加载。
— Runtime Data Areas contain method areas, PC registers, stack areas, and threads.
运行时数据区包含方法区、PC寄存器、栈区和线程。
— Execution Engine contains an interpreter, compiler, and garbage collection area.
执行引擎包含解释器、编译器和垃圾回收区。
What is Java Runtime Environment (JRE)?
Java Runtime Environment, or JRE, is a set of software tools responsible for execution of the Java program or application on your system.
JRE uses heap space for dynamic memory allocation for Java objects. JRE is also used in JDB (Java Debugging).
Java运行时环境(JRE)是一组软件工具,负责在您的系统上执行Java程序或应用程序。
JRE使用堆空间为Java对象动态分配内存。JRE还用于JDB(Java调试)。
The role of JRE in Java
If a programmer would like to run a Java program by using the Java command, they should install JRE. If they are only installing (and not developing or compiling code), then only JRE is needed.
如果程序员想使用 Java 命令运行 Java 程序,他们应该安装 JRE。如果他们只是安装(而不开发或编译代码),那么只需要 JRE 即可。
JRE components
Besides the Java virtual machine, JRE is composed of various other supporting software tools and features to get the most out of your Java applications.
除了Java虚拟机,JRE还包含各种其他支持软件工具和功能,以充分发挥Java应用程序的潜力。
— Deployment solutions: Included as part of the JRE installation are deployment technologies like Java Web Start and Java plug-in that simplify the activation of applications and provide advanced support for future Java updates.
部署解决方案:作为JRE安装的一部分,包含了Java Web Start和Java插件等部署技术,这些技术简化了应用程序的激活过程,并为未来的Java更新提供了高级支持。
— Development toolkits: JRE also contains development tools that are designed to help developers improve their user interface. Some of these toolkits include the following:
开发工具包:JRE还包含旨在帮助开发人员改进用户界面的开发工具。其中一些工具包包括以下内容:
· Java 2D: An application programming interface (API) used for drawing two-dimensional graphics in Java language. Developers can create rich user interfaces, special effects, games, and animations.
Java 2D:一种用于在Java语言中绘制二维图形的应用程序编程接口(API)。开发者可以利用它创建丰富的用户界面、特效、游戏和动画。
· Abstract Window Toolkit (AWT): A graphical user interface (GUI) that is used to create objects, buttons, scroll bars, and windows.
抽象窗口工具包(AWT):一种用于创建对象、按钮、滚动条和窗口的图形用户界面(GUI)。
· Swing: Another lightweight GUI that uses a rich set of widgets to offer flexible, user-friendly customizations.
· Swing:另一种轻量级GUI,它使用丰富的组件集提供灵活、用户友好的自定义选项。
Integration libraries: Java Runtime Environment provides several integration libraries and class libraries to assist developers in creating seamless data connections between their applications and services. Some of these libraries include the following:
集成库:Java运行时环境提供了多个集成库和类库,帮助开发者在应用程序与服务之间创建无缝的数据连接。其中包括以下库:
· Java IDL: Uses Common Object Request Brokerage Architecture (CORBA) to support distributed objects written in the Java programming language.
Java IDL:使用公共对象请求代理体系结构(CORBA)来支持用Java编程语言编写的分布式对象。
· Java Database Connectivity (JDBC) API: Provides tools for developers to write applications with access to remote relationship databases, flat files, and spreadsheets.
· Java 数据库连接(JDBC)API:为开发者提供工具,用于编写可访问远程关系型数据库、平面文件和电子表格的应用程序。
· Java Naming and Directory Interface (JNDI): A programming interface and directory service that lets clients create portable applications that can fetch information from databases by using naming conventions.
Java命名和目录接口(JNDI):一种编程接口和目录服务,允许客户端创建可移植应用程序,这些应用程序能通过命名约定从数据库中获取信息。
Language and utility libraries: Included with JRE are Java.lang. and Java.util. packages that are fundamental for the design of Java applications, package versioning, management, and monitoring. Some of these packages include the following
语言和实用工具库:JRE包含Java.lang和Java.util包,这些是Java应用程序设计、包版本控制、管理和监控的基础。其中一些包包括以下内容
· Collections framework: A unified architecture that is made up of a collection of interfaces that are designed to improve the storage and process of application data.
集合框架:一种由一组接口组成的统一架构,旨在改善应用数据的存储和处理。
· Concurrency utilities: A powerful framework package with high-performance threading utilities.
并发实用工具:一个强大的框架包,包含高性能的线程实用工具。
· Preferences API: A lightweight, cross-platform persistent API that enables multiple users on the same machine to define their own group of application preferences.
Preferences API:一种轻量级、跨平台的持久化API,允许同一台机器上的多个用户定义各自的应用偏好设置组。
· Logging: Produces log reports—such as security failures, configuration errors, and performance issues—for further analysis.
日志记录:生成日志报告(如安全故障、配置错误和性能问题)以供进一步分析。
· Java Archive (JAR): A platform-independent file format that enables multiple files to be bundled in JAR file format, significantly improving download speed and reducing file size.
Java归档文件(JAR):一种与平台无关的文件格式,可将多个文件打包成JAR文件格式,显著提高下载速度并减小文件大小。
What is Java Development Kit (JDK)?
Java Development Kit, or JDK, is a software development kit that is a superset of JRE. It is the foundational component that enables Java application and Java applet development. It is platform-specific, so separate installers are needed for each operating system (for example, Mac, Unix, and Windows).
Java开发工具包(JDK)是JRE的超集软件开发套件。它是支持Java应用程序和Java小程序开发的基础组件。JDK具有平台依赖性,因此需要为每个操作系统(例如Mac、Unix和Windows)提供单独的安装程序。
The role of JDK in Java
JDK contains all the tools that are required to compile, debug, and run a program developed using the Java platform. (It’s worth noting that Java programs can also be run by using command line.)
JDK包含了编译、调试和运行基于Java平台开发的程序所需的所有工具。(值得注意的是,Java程序也可以通过命令行来运行。)
JDK components
JDK includes all the Java tools, executables, and binaries that are needed to run Java programs. This includes JRE, a compiler, a debugger, an archiver, and other tools that are used in Java development.
JDK包含了运行Java程序所需的所有Java工具、可执行文件和二进制文件。这包括JRE(Java运行时环境)、编译器、调试器、归档工具以及其他用于Java开发的工具。
How JVM, JRE and JDK work together
Let’s first look at how the three core components of Java work together, and then we can examine the differences. The following diagram provides an image of how JVM, JRE, and JDK fit together in the Java landscape.
我们先来看看Java的三大核心组件如何协同工作,然后再分析它们之间的区别。下图展示了JVM、JRE和JDK在Java体系中的相互关系。
If you envision a baseball sliced open, it contains three main components: the round cushioned core, the wool and cotton midsection and the cowhide exterior. A ball without all three of these layers will not perform its intended function. Much like the three basic parts of a baseball, JVM, JRE, and JDK all have specific functions. Without all three, Java will not operate successfully.
如果你想象一个被切开的棒球,它包含三个主要部分:圆形缓冲核心、羊毛和棉质中间层以及牛皮外层。缺少这三层中的任何一层,球都无法发挥其预期功能。就像棒球的三个基本组成部分一样,JVM、JRE和JDK各自具有特定功能。缺少其中任何一个,Java都无法成功运行。

OpenJDK and IBM Runtimes for Business
— https://www.ibm.com/products/runtimes-for-business
IBM 的 Java 套件组成
OpenJ9 — JVM
Optimized to run Java™ applications cost-effectively in the cloud, Eclipse OpenJ9™ is a fast and efficient JVM that delivers power and performance when you need it most.
Eclipse OpenJ9™ 是一款专为云端经济高效运行 Java™ 应用程序而优化的快速高效 JVM,能在您最需要时提供强劲性能。
IBM Semeru Runtimes — JRE
— https://developer.ibm.com/languages/semeru-runtimes/
The IBM Semeru Runtimes are free enterprise-ready OpenJDK-based binaries that can drop-in replace your current Java language runtime. Built with the OpenJDK class libraries and the Eclipse OpenJ9 JVM, IBM Semeru Runtimes deliver high quality, strong security, and top performance to run your Java applications cost-effectively on-prem or in the cloud.
IBM Semeru运行库是免费的企业级OpenJDK二进制发行版,可直接替换您现有的Java语言运行时环境。它基于OpenJDK类库和Eclipse OpenJ9 JVM构建,能为您在本地或云端运行的Java应用程序提供高质量、强安全性和卓越性能,同时实现成本效益。

IBM Semeru Runtimes is available in two editions with different licenses:
IBM Semeru Runtime™ Certified Edition has an IBM license and is a Java Platform, Standard Edition compatible implementation.
IBM Semeru Runtime Open Edition has an open source license (GPLv2+Classpath extension).
Temurin® JDK — JDK
OpenJDK Based: Eclipse Temurin offers high-performance, cross-platform, open source Java™ Runtimes binaries that are enterprise-ready and Java SE TCK certified and AQAvit verified for general use in the Java Ecosystem.
基于 OpenJDK:Eclipse Temurin 提供高性能、跨平台的开源 Java™ 运行时二进制文件,这些文件已做好企业级准备,并通过 Java SE TCK 认证和 AQAvit 验证,适用于 Java 生态系统中的通用场景。
-------------------------------------------------
Google JVM
Dalvik
https://en.wikipedia.org/wiki/Dalvik_(software)
转为 Android 打造的虚拟机;现在整合在 Android Runtime (ART)
Azul JVM
Zing
https://www.azul.com/products/components/azul-zing-builds-of-openjdk/
Azul为 zulu JDK 打造的虚拟机,低延迟,以及C4回收机制。
Oracle JVM
HotSpot JVM
https://www.oracle.com/java/technologies/whitepaper.html
The Java HotSpot™ virtual machine implementation (Java HotSpot™ VM) is Sun Microsystems, Inc.'s high-performance VM for the Java platform. Java HotSpot technology provides the foundation for the Java SE platform, the premier solution for rapidly developing and deploying business-critical desktop and enterprise applications. Java SE technology is available for the Solaris Operating Environment (OE), Linux, and Microsoft Windows, as well as other platforms through Java technology licensees.
Java HotSpot™ 虚拟机实现 (Java HotSpot™ VM) 是 Sun Microsystems 公司为 Java 平台开发的高性能虚拟机。Java HotSpot 技术为 Java SE 平台奠定了基础,该平台是快速开发和部署关键业务桌面应用及企业级应用的首选解决方案。Java SE 技术适用于 Solaris 操作系统环境(OE)、Linux 和 Microsoft Windows 平台,也可通过 Java 技术授权商获取其他平台版本。
补充: Open JDK 也是 HotSpot JVM 。
补充: Oracle 收购了 BEA ,将 BEA 的 JVM JRockit 纳入了 HotSpot 。
GraalVM
给高效能打造一款虚拟机,来自 Oracle Labs 。
IBM
OpenJ9
Optimized to run Java™ applications cost-effectively in the cloud, Eclipse OpenJ9™ is a fast and efficient JVM that delivers power and performance when you need it most.
为在云环境中经济高效地运行Java™应用而优化,Eclipse OpenJ9™是一款快速高效的JVM,能在您最需要时提供强劲动力与卓越性能。
国产 JVM —— 华为和阿里
阿里 Jeandle
https://blog.csdn.net/D1237890/article/details/150522530
华为 毕晟
https://blog.csdn.net/D1237890/article/details/150523309
在 Java JDK 方面, IBM 拥有 Eclipse基金会庞大的资源,以及非常早期的 Java 应用服务器 WebSphere ;功力深厚。
就是收购了 SUN 公司和 BEA 公司的 Oracle了。
再有就是独立发展的 Azul ,以及其 Java 云服务的全套套件了。
应用服务器配置 JVM JRE 和 JDK 案例
https://openliberty.io/docs/latest/java-se.html
Open Liberty requires a Java SE runtime

参 考
https://docs.oracle.com/javase/8/docs/
https://docs.oracle.com/javase/6/docs/
https://www.ibm.com/think/topics/jvm-vs-jre-vs-jdk
https://www.ibm.com/think/topics/jre
https://www.ibm.com/think/topics/virtual-machines
https://www.ibm.com/think/topics/containers
https://www.oracle.com/java/technologies/javase/jdk21-archive-downloads.html
https://docs.oracle.com/en/java/javase/24/
https://docs.oracle.com/javase/specs/jls/se24/html/index.html
https://docs.oracle.com/javase/specs/index.html
https://docs.oracle.com/en/java/javase/24/language/java-language-changes-summary.html
https://docs.oracle.com/en/java/javase/24/docs/api/index.html
https://docs.oracle.com/en/java/javase/24/books.html
https://docs.oracle.com/en/java/javase/24/core/index.html
https://developer.aliyun.com/article/1172237 大量图示解释
https://en.wikipedia.org/wiki/Dalvik_(software)
https://source.android.com/docs/core/runtime?hl=zh-cn
https://www.oracle.com/java/technologies/whitepaper.html
https://www.azul.com/products/components/azul-zing-builds-of-openjdk/
https://docs.oracle.com/cd/E13188_01/jrockit/docs50/userguide/start.html
更多推荐

所有评论(0)