Java编译器(javac)、虚拟机(JVM)和Java启动器是用哪种语言编写的?
当前回答
第一个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)
这个链接应该能回答你的问题
现在编译器似乎是用Java编写的,但运行时是用ANSI C编写的
第一个Java编译器是由Sun Microsystems开发的,用C语言编写,使用了c++中的一些库。今天,Java编译器是用Java编写的,而JRE是用C编写的。
我们可以想象一下Java编译器是如何用Java编写的:
Java编译器是作为Java程序编写的,然后用C语言编写的Java编译器(第一个Java编译器)进行编译。因此,我们可以使用新编译的Java编译器(用Java编写)来编译Java程序。
When Java was introduced by Sun Microsystem, the java compiler was written in C using some libraries from C++. As there is a concept in Compiler Design called Bootstrapping, Mostly it is used in Compiler Development, Bootstrapping is the process of writing a compiler(Or Assembler) In the source programming language which it is intended to compile. It is used to produce a self-hosting compiler. The development of compilers for new Programming languages first developed in an existing language and then rewritten in the new language and compiled by itself. That's why today, Java compiler is written in Java itself. Java Virtual Machine: Java virtual machine is an abstract machine. Like a real computing machine, It has an instruction set and manipulates various memory areas of runtime. Usually, JVM interprets the byte code into Machine code.
(有关更多信息,您可以查看此链接:https://docs.oracle.com/javase/specs/jvms/se7/html/)
假设您谈论的是Hotspot JVM,它是Sun提供的iirc,它是用c++编写的。有关Java的各种虚拟机的更多信息,可以查看这个链接。 javac,像大多数Java编译器一样,是用Java编写的。
推荐文章
- 如何在java中格式化持续时间?(如格式H:MM:SS)
- urlencoder .encode(字符串)已弃用,我应该使用什么代替?
- javax.transaction.Transactional vs . org.springframework.transaction.annotation.Transactional
- Java 8接口方法中不允许“同步”的原因是什么?
- 如何找到Java堆大小和内存使用(Linux)?
- 使用Enum实现单例(Java)
- RabbitMQ与通道和连接之间的关系
- buildSessionFactory()配置方法在Hibernate中已弃用?
- Spring MVC -如何获得所有的请求参数在一个地图在Spring控制器?
- 如何在Java中按两个字段排序?
- 文件之间的差异。路径中的分隔符和斜杠
- 在方法参数中使用NotNull注释
- Spring MVC中处理可选参数的@RequestParam
- Tomcat:如何查找正在运行的Tomcat版本?
- “java”、“javaw”和“javaws”之间有什么区别?