5

I know that they are both called 'virtual machines', but what is the exact difference?

3 Answers 3

4

The term virtual machine is a colloquialism in that it simply refers to the idea of a machine (not the actual thing itself). Due to this it can refer to almost any piece of software (hence the virtual) that "acts" like a machine. A video game emulator is a virtual machine (and actually quite like how the JavaVM works).

The biggest difference between types of virtual machines is in what they virtualize and how they do it (i.e. how they abstract the idea of a machine).

VMWare (VirtualBox/etc.) attempt to present the hardware on the host machine to the guest machine so the guest machine can use the hardware directly (like being able to use a USB device on the guest) and in this context not much is actually virtualized (in the classic sense of the word) since the guest uses the hardware itself. To this, VMWare/etc. are more like hardware proxies more so than a "virtual machine". Software built for one platform/architecture will still only run for that platform/architecture regardless of virtual machine guest/host.

As for Java, it's more proper to say "the" Java Virtual Machine, more than "a" Java virtual machine; the JVM attempts to abstract the hardware and machine itself so the developer doesn't have to concern themselves with things like architecture type or platform. Software built with Java should run on any platform that has the proper JVM version installed, regardless of physical machine type.

The difference between these two concepts of a virtual machine is in abstraction and running code natively (i.e. direct on the hardware). The JVM attempts to abstract as much of the platform/architecture/machine as possible to make the code as agnostic as possible to be able to run on as many devices as possible (that support Java), where as a VMWare/VirtualBox container abstracts the physicality of the machine as much as possible so you can reduce the physical hardware needed to run a platform, though you still have the same soft limitations (e.g. I can't write ARM assembly and expect it to 'just run' on an x86 processor in VMWare/VirtualBox).

There's quite a bit more detail that could be explained in the 'exact' differences between these 2 types of virtual machines (more so than say comparing the JVM to .NET or the WINE emulator), but that gets into lower level systems design; at a high level though, this should help explain the key differences between the JVM and a VMWare VM.

I hope that helps to add some clarity.

2
  • "it's more proper"... I disagree; if there are two physical systems using Java, I'd say there is a virtual machine running on each, so there are two virtual machines. (This statement is largely based on opinion.)
    – TOOGAM
    Apr 5, 2016 at 2:06
  • @TOOGAM, in the context of the question/answer, it's proper to use "the" vs. "a" since the OP is asking about the differences between "a" VMWare VM (a thing) and "the" Java Virtual Machine (an idea). In actually referencing the instances of the running JVM then yes, "a" would be proper, as in those 2 machines have "a" JVM running, etc. Not trying to be pedantic, just clarifying why I was specifying "the" vs. "a" :)
    – txtechhelp
    Apr 5, 2016 at 3:22
1

The main difference is the underlying machine. With Java, it is a well specified ad hoc pure software machine with its own machine language (bytecode) while with VMWare (or VirtualBox, etc.), the underlying machine presented is close to a physical PC using the same machine language as the real hardware (x86).

0

JVM is a virtual machine that Java uses to execute Java programs, so the developer just compile the code once, then the program can be run on other OSs and architectures without recompiling it, with a condition, the Java program should be run by JVM that is compatible with the machine's architecture and OSs.

VMware VM is hypervisor software, that creates and runs virtual machine. The "virtual machine" here is like quoted from Wikipedia:

In computing, a virtual machine (VM) is an emulation of a computer system. Virtual machines are based on computer architectures and provide functionality of a physical computer. Their implementations may involve specialized hardware, software, or a combination.

https://en.wikipedia.org/wiki/Java_virtual_machine

https://en.wikipedia.org/wiki/Hypervisor

Virtual_machine

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.