In which languages are the Java compiler (javac
), the virtual machine (JVM) and the java
starter written?
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.
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)
In principle almost anything, usually C
This link should answer your question
It seems the compiler is now written in Java, but the runtime is written in ANSI C
Supposing you're talking about the Hotspot JVM, which is iirc provided by Sun, it is written in C++. For more info on the various virtual machines for Java, you can check this link. javac, like most Java compilers, is written in Java.
(For More Information You can check this link : https://docs.oracle.com/javase/specs/jvms/se7/html/)
From Java Docs
The compiler is written in Java and the runtime is written in ANSI C