Hi
can you please let me know in which language the Java compiler, virtual machine (JVM
) and java
is written.
views:
1981answers:
8From Java Docs
The compiler is written in Java and the runtime is written in ANSI C
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 SmalltalkThe Java libraries (
java.lang
,java.util
etc, often referred to as the Java API) are themselves written in Java, although methods marked asnative
will have been written inC
orC++
.I believe that the Java compiler provided by Sun is also written in Java. (Although again, there are multiple compilers out there)
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.
Should you wish to, you can download the sources for the OpenJDK from jdk.dev.java.net.
Most OSes, JVMs are written in ISO C++. I doubt ANSI C is used, an entirely different language that is quite antiquated nowadays.