微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐