且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Java 编译器和 JVM 是用哪种语言编写的?

更新时间:2023-11-10 17:00:28

这个问题的准确措辞有点误导:它不是JVM"编译器" 因为有多个 JVM 供应商(jrockit 是一个,IBM 是另一个)和 多个编译器.

The precise phrasing of the question is slightly misleading: it is not "the JVM" or "the compiler" as there are multiple JVM vendors (jrockit is one, IBM another) and multiple compilers out there.

  • Sun JVM C 编写的,尽管不一定如此 - 在您的机器上运行的 JVM 是一个平台-dependent 可执行,因此 可以 最初是用任何语言编写的.例如,最初的 IBM JVM 是用 Smalltalk

  • The Sun JVM is written in C, although this need not be the case - the JVM as it runs on your machine is a platform-dependent executable and hence could have been originally written in any language. For example, the original IBM JVM was written in Smalltalk

Java 库(java.langjava.util 等,通常称为Java API)本身就是用 Java 编写,尽管标记为 native 的方法将用 CC++ 编写.

The Java libraries (java.lang, java.util etc, often referred to as the Java API) are themselves written in Java, although methods marked as native will have been written in C or C++.

相信Sun提供的Java编译器也是用Java编写的.(虽然同样有多个编译器)

I believe that the Java compiler provided by Sun is also written in Java. (Although again, there are multiple compilers out there)