java - JVM存在的原因

标签 java jvm

我正在自学编程语言理论,我想知道,为什么我们需要 Java 虚拟机或任何虚拟机来解决这个问题?根本原因是什么?

仅仅是为了让它成为多平台的吗?如果是这样,为什么我们不能只拥有一种独立于平台的语言和针对不同平台的不同编译器?

最佳答案

在他们 1996 年的白皮书中 The Java Language Environment ,Sun 的 Java 团队声明如下 design goals对于 Java 语言:

The design requirements of the Java TM programming language are driven by the nature of the computing environments in which software must be deployed.

The massive growth of the Internet and the World-Wide Web leads us to a completely new way of looking at development and distribution of software. To live in the world of electronic commerce and distribution, Java technology must enable the development of secure, high performance, and highly robust applications on multiple platforms in heterogeneous, distributed networks.

Operating on multiple platforms in heterogeneous networks invalidates the traditional schemes of binary distribution, release, upgrade, patch, and so on. To survive in this jungle, the Java programming language must be architecture neutral, portable, and dynamically adaptable.

The system that emerged to meet these needs is simple, so it can be easily programmed by most developers; familiar, so that current developers can easily learn the Java programming language; object oriented, to take advantage of modern software development methodologies and to fit into distributed client-server applications; multithreaded, for high performance in applications that need to perform multiple concurrent activities, such as multimedia; and interpreted, for maximum portability and dynamic capabilities.

再往下一点,他们更详细地说明了使用解释器的原因:

The Java interpreter can execute Java bytecodes directly on any machine to which the interpreter and run-time system have been ported. In an interpreted platform such as Java technology-based system, the link phase of a program is simple, incremental, and lightweight. You benefit from much faster development cycles--prototyping, experimentation, and rapid development are the normal case, versus the traditional heavyweight compile, link, and test cycles.

While the Java Compiler is strict in its compile-time static checking, the language and run-time system are dynamic in their linking stages. Classes are linked only as needed. New code modules can be linked in on demand from a variety of sources, even from sources across a network. In the case of the HotJava Browser and similar applications, interactive executable code can be loaded from anywhere, which enables transparent updating of applications. The result is on-line services that constantly evolve; they can remain innovative and fresh, draw more customers, and spur the growth of electronic commerce on the Internet.

关于java - JVM存在的原因,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22878183/

相关文章:

java - 我如何解码具有允许在 jibx 中使用多个枚举值的属性的 XML 文档?

java - JVM 基准测试应用程序

java - 使用 Jersey Client POST 方法调用 RESTful Web 服务时出错

java - 如何使用 StringTokenizer 获取字符串中的特定值

java - Android getter setter返回空数据?

Java 垃圾收集引用类

java - 多模块项目的热交换代理配置

java - Spring MVC : With SimpleMappingExceptionResolver, 向 View 传递了哪些参数

Java user.home 被设置为 %userprofile% 并且没有被解析

java - 给jvm添加内存