What language is Sun's JVM
written in?
Asked
Active
Viewed 3.7k times
50
-
1possible duplicate of [In which language are the Java compiler, JVM and Java written?](http://stackoverflow.com/questions/1220914/in-which-language-are-the-java-compiler-jvm-and-java-written). This is older, but it is a subset and has less votes. – Ciro Santilli OurBigBook.com Mar 05 '15 at 13:08
4 Answers
42
Sun actually has multiple JVMs. The HotSpot JVM is written largely in C++, because HotSpot is heavily based on the Animorphic Smalltalk VM which is written in C++.
More interesting than HotSpot is IMHO the Maxine Research VM, which is written (almost) completely in Java.

Jörg W Mittag
- 363,080
- 75
- 446
- 653
-
5"Low-church C++" would be a more accurate way of describing it. – Tom Hawtin - tackline Jan 04 '09 at 13:41
-
1Maxine will be definitely such a great thing, when it'll be ready! – ivan_ivanovich_ivanoff Apr 08 '09 at 17:58
-
1Well, it's a research project. By definition, it'll never be ready. – Jörg W Mittag Apr 08 '09 at 21:07
25
Strictly speaking, C++ (the JVM code does make use of C++ OO facilities).

Neil Coffey
- 21,615
- 7
- 62
- 83
5
C.
Sun's not a Java shop; it's a C shop. That's what Solaris is written in.

duffymo
- 305,152
- 44
- 369
- 561
-
2It should be noted that nearly all the Java standard libraries however are written in Java. – cletus Jan 04 '09 at 02:51
-
1Absolutely correct, of course, but the question was about the JVM itself. – duffymo Jan 04 '09 at 02:52
-
At a guess, the C source includes some ASM - conditionally compiled on certain mainstream architectures. – slim Jan 04 '09 at 02:54
-
Also: Sun's a big company. Parts of it will be a 'C shop', other parts will be writing in Java, or in shell, or Perl, or whatever. Solaris is written in C largely because when they got SysV from AT&T it was in C. – slim Jan 04 '09 at 03:05
-
Still, a large part of the JVM is written in C. (Or, was when I last looked at it.) – Jonathan Leffler Jan 04 '09 at 03:13
-
slim: The interpreters are written in an assembly language-like way in C++ (the C++ generates machine code). – Tom Hawtin - tackline Jan 04 '09 at 13:38
-
Some of the libraries are written in C, some date back to before Java. Most of the libraries are Java. HotSpot is low-church C++, not C. – Tom Hawtin - tackline Jan 04 '09 at 13:39
-
2Silly response. They were supposed to jump in the time machine and suggest Java for implementing Unix in 1970? They were supposed to rewrite their Solaris in Java? There have been a few Java OS's written, none targeting servers like Solaris does. – John M Jan 09 '09 at 20:21