Java编译器(javac)、虚拟机(JVM)和Java启动器是用哪种语言编写的?


当前回答

Jikes RVM,一个广泛用于研究目的的自托管JVM,是用Java编写的。它不是人们在桌面上运行的那种,但它在我的“现在让我们展示一下这种语言的强大功能”列表中名列前茅。

其他回答

原则上几乎任何事情,通常C

一如既往的流行语言,用- C、c++编写。

来自Java文档

编译器是用Java编写的,运行时是用ANSI C编写的

第一个Java编译器是由Sun Microsystems开发的,用C语言编写,使用了c++中的一些库。今天,Java编译器是用Java编写的,而JRE是用C编写的。

我们可以想象一下Java编译器是如何用Java编写的:

Java编译器是作为Java程序编写的,然后用C语言编写的Java编译器(第一个Java编译器)进行编译。因此,我们可以使用新编译的Java编译器(用Java编写)来编译Java程序。

这个问题的精确措辞有点误导人:它不是“JVM”或“编译器”,因为有多个JVM供应商(jrockit是一个,IBM是另一个)和多个编译器。

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 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++. I believe that the Java compiler provided by Sun is also written in Java. (Although again, there are multiple compilers out there)