tags:

views:

128

answers:

5

Is jvm software based? If so in which language is jvm coded?

+4  A: 

Kind of... it's more like a standard that has resulted in a number of pieces of software. You cannot be 100% certain what language the JVM is written in, but in most cases, I'd bet it was written in C/C++.

You took the words right out of my, er, text box.
mdm
@mdm: Thank you.
FWIW, it is written in C++ using Visual Studio and gcc. One of the Java engineers is a neighbor :)
Michael Howard-MSFT
@Michael, there is no single JVM. The Sun Java JVM is one implementation... there are others, including the one used on Mac OS X, and there are a handful of open source JVMs out there, as well.
Michael Aaron Safyan
A: 

JVM stands for "Java Virtual Machine". It's a virtualised environment that provides Java applications with a way of running in the same way across multiple different physical environments.

The idea is that Java code is compiled and is executed by the JVM. The JVM provides the same look and feel for the actual code regardless of whether it's being run on a massively parallel mainframe or a single processor PC running Windows XP.

These days the JVM is being used for languages other than Java (Scala, for example).

Andrew
@Andrew could you please specify whether its a software
abson
Yes, it's software.
Andrew
+1  A: 

To answer what I think is your question, the JVM is written in C++. The majority of the Java libraries are written in Java, however.

Same applies to .NET: The code CLR/VM is written in C++, but the class libs are written in C#.

Michael Howard-MSFT
+4  A: 

Almost all JVMs are implemented in software. However, a JVM is anything that interprets Java bytecode in a manner that complies with the JVM specification, and there are some hardware-based JVMs as well.

Michael Aaron Safyan
There are even semi-hardware implementations of JVM. See http://en.wikipedia.org/wiki/Jazelle
thorn
If it's implemented in hardware, it's not really a "virtual" machine anymore, is it?
Michael Borgwardt
@Michael, haha, no, I guess not.... it's kind of like how people say "ATM machine" instead of ATM, but I think the OP would still like to know that Java can be interpreted at the hardware level.
Michael Aaron Safyan
@Michael - except that it is often difficult to know where the boundary is. For instance, micro or nano-coded machines, machines where part of the "instruction set" is implemented by trapping to a software implementation, etc.
Stephen C
+2  A: 

Java Virtual Machine is a specification for how a virtual machine needs to behave by interpreting bytecode as instructions in the virtual machine's operation set. If there's some mechanism that interprets the bytecode and behaves the right way, it is a JVM, no matter how it's implemented.

That means a JVM can be implemented in a program, or it can equally well be implemented in hardware. If you want to know which is the case, you need to be talking about some specific implementation.

bignose