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


当前回答

这个链接应该能回答你的问题

现在编译器似乎是用Java编写的,但运行时是用ANSI C编写的

其他回答

来自Java文档

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

这个问题的精确措辞有点误导人:它不是“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)

假设您谈论的是Hotspot JVM,它是Sun提供的iirc,它是用c++编写的。有关Java的各种虚拟机的更多信息,可以查看这个链接。 javac,像大多数Java编译器一样,是用Java编写的。

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

这个链接应该能回答你的问题

现在编译器似乎是用Java编写的,但运行时是用ANSI C编写的