JVM、JDK、JRE & 有什么区别?开放JDK? [英] What is the difference between JVM, JDK, JRE & OpenJDK?

查看:39
本文介绍了JVM、JDK、JRE & 有什么区别?开放JDK?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

JVMJDKJRE和有什么区别?OpenJDK?

我在用Java编程时遇到了这些短语,它们之间有什么区别?

I was programming in Java and I encountered these phrases, what are the differences among them?

推荐答案

JVM

Java 虚拟机 (JVM) 是运行 Java 字节码的虚拟机.JVM 不理解 Java 源代码;这就是为什么您需要编译您的 *.java 文件以获得包含 JVM 可以理解的字节码的 *.class 文件.它也是让 Java 成为可移植语言"的实体.(一次编写,随处运行).事实上,JVM 有针对不同系统的特定实现(Windows、Linux、macOS,参见维基百科列表),目的是使用相同的字节码,它们都给出相同的结果.

JVM

The Java Virtual Machine (JVM) is the virtual machine that runs the Java bytecodes. The JVM doesn't understand Java source code; that's why you need compile your *.java files to obtain *.class files that contain the bytecodes understood by the JVM. It's also the entity that allows Java to be a "portable language" (write once, run anywhere). Indeed, there are specific implementations of the JVM for different systems (Windows, Linux, macOS, see the Wikipedia list), the aim is that with the same bytecodes they all give the same results.

要解释JDK和JRE的区别,最好阅读Oracle 文档 并参考图表:

To explain the difference between JDK and JRE, the best is to read the Oracle documentation and consult the diagram:

Java 运行时环境 (JRE)

Java 运行时环境 (JRE) 提供库、Java 虚拟机和其他组件来运行用 Java 编程语言编写的小程序和应用程序.此外,JRE 还包含两项关键部署技术:Java 插件,它使小程序能够在流行的浏览器中运行;和 Java Web Start,它通过网络部署独立的应用程序.它也是用于企业软件开发和部署的 Java 2 平台企业版 (J2EE) 技术的基础.JRE 不包含用于开发小程序和应用程序的工具和实用程序,例如编译器或调试器.

The Java Runtime Environment (JRE) provides the libraries, the Java Virtual Machine, and other components to run applets and applications written in the Java programming language. In addition, two key deployment technologies are part of the JRE: Java Plug-in, which enables applets to run in popular browsers; and Java Web Start, which deploys standalone applications over a network. It is also the foundation for the technologies in the Java 2 Platform, Enterprise Edition (J2EE) for enterprise software development and deployment. The JRE does not contain tools and utilities such as compilers or debuggers for developing applets and applications.

Java 开发工具包 (JDK)

JDK 是 JRE 的超集,包含 JRE 中的所有内容,以及开发小程序和应用程序所需的编译器和调试器等工具.

The JDK is a superset of the JRE, and contains everything that is in the JRE, plus tools such as the compilers and debuggers necessary for developing applets and applications.

请注意,Oracle 并不是唯一提供 JDK 的.

Note that Oracle is not the only one to provide JDKs.

OpenJDK 是 JDK 的开源实现,并且Oracle JDK 的基础.Oracle JDK 和 OpenJDK 几乎没有区别.

OpenJDK is an open-source implementation of the JDK and the base for the Oracle JDK. There is almost no difference between the Oracle JDK and the OpenJDK.

中说明了差异博客:

问:在 OpenJDK 存储库中找到的源代码与您用于构建 Oracle JDK 的代码有什么区别?

Q: What is the difference between the source code found in the OpenJDK repository, and the code you use to build the Oracle JDK?

A:非常接近 - 我们的 Oracle JDK 版本的构建过程是在 OpenJDK 7 上构建的,只添加了几部分,例如部署代码,其中包括 Oracle 对 Java 插件和 Java WebStart 的实现,以及一些封闭源代码的第三方组件,例如图形光栅化器,一些开源的第三方组件,例如 Rhino,以及一些零碎的东西,例如附加文档或第三方字体.展望未来,我们的目标是开源 Oracle JDK 的所有部分,除了那些我们认为是商业特性的部分,例如 JRockit Mission Control(Oracle JDK 中尚不可用),并用开源替代品替换受阻的第三方组件以实现更接近的平等代码库之间.

A: It is very close - our build process for Oracle JDK releases builds on OpenJDK 7 by adding just a couple of pieces, like the deployment code, which includes Oracle's implementation of the Java Plugin and Java WebStart, as well as some closed source third party components like a graphics rasterizer, some open source third party components, like Rhino, and a few bits and pieces here and there, like additional documentation or third party fonts. Moving forward, our intent is to open source all pieces of the Oracle JDK except those that we consider commercial features such as JRockit Mission Control (not yet available in Oracle JDK), and replace encumbered third party components with open source alternatives to achieve closer parity between the code bases.

JDK 11 更新

Donald Smith 的一篇文章试图消除 Oracle JDK 和 Oracle 的 OpenJDK 之间的区别:https://blogs.oracle.com/java-platform-group/oracle-jdk-releases-for-java-11-and-later

正如@Alan Evangelista 在评论中提到的,Java Web Start 在 Java SE 9 中已被 Oracle 弃用,并在 Java SE 11 中被删除.

As mentionned in comments by @Alan Evangelista, Java Web Start has been deprecated by Oracle in Java SE 9 and removed in Java SE 11.

这篇关于JVM、JDK、JRE & 有什么区别?开放JDK?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆