java – JVM存在的原因

前端之家收集整理的这篇文章主要介绍了java – JVM存在的原因前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在自学编程语言理论,我想知道为什么我们需要一个 Java虚拟机或任何虚拟机呢?根本原因是什么?

它只是为了让它成为多平台吗?如果是这样,为什么我们不能只为不同的平台提供独立于平台的语言和不同的编译器?

解决方法

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

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.

猜你在找的JVM相关文章