What is a JVM?


Definition” Java Virtual Machine ” What is a JVM?

The Java Virtual Machine, JVM for short, is the central component of the JRE, i.e. the Java Runtime Environment or Java runtime environment. It enables the platform-independent execution of programs in Java bytecode

Company about the topic

Thanks to the Java Virtual Machine, Java apps run on all platforms for which such a JVM exists.Thanks to the Java Virtual Machine, Java apps run on all platforms for which such a JVM exists.

For higher programming languages such as C and C++, the compilers usually generate a directly executable program file. Such “native executables” consist of the machine language commands of a specific hardware architecture.

This has the advantage of a slightly faster execution and fewer dependencies on complex runtime environments. However, the program must be recompiled for each supported hardware platform and operating system, as well as for changes to the source code.

Languages like Java, C# or Python go a different way. Under the motto “Write once, run everywhere”, Java wants to achieve maximum portability. The Java compiler “javac” translates the source code into an intermediate code that is not yet executable. A JVM is required for the final execution.

How does the JVM work?

The JVM is a process – based VM-a very simple virtual computer running the Java bytecode. Such VMs translate the instructions of the byte code at runtime into the machine code of the real hardware as well as into the system calls of the operating system. This has the advantage of a high portability.

One and the same program can run without recompiling on all systems for which there is a corresponding VM. Unlike system-based VMs such as VirtualBox, VMware or Hyper-V, they deliberately only allow the execution of a single application instead of an entire operating system.

In addition to platform independence, the JVM has other advantages in terms of speed and safety. Translation at runtime can make dynamic optimizations that are not possible with conventional ahead-of-time compilers. For example, the just-in-time compiler can completely remove code paths and loops that are not necessary with the existing input data. This increases the speed of functions in the further course of execution.

Security is one of the basic outstaffing design criteria of the Java VM. Through the virtual machine, Java programs are largely isolated from the operating system. Access to the resources of the underlying system can be precisely controlled. The JVM contains automatic memory management via garbage collector. Typical programming errors such as buffer overflow and crashes due to prematurely released memory are not possible in the VM.

One VM, many languages

The Java VM executes an intermediate code that has little to do with the actual programming language. Therefore, the JVM is not only applicable in Java programming. In principle, each language can be translated into a JVM-compatible bytecode. Only a corresponding compiler is required.

The use of other languages provides not only the advantage of platform independence but also a better integration of different software systems. For example, the Python variant Jython runs on the JVM. It can use Java classes and enables seamless integration of Python and Java code. Other languages for the JVM include the LISP dialect Clojure, the functional languages Erjang and Scala as well as Kotlin, Groovy and Jruby.

Implementations of the Java VM

In addition to Oracle’s official hotspot JVM, there are several other implementations of the Java VM. They differ mainly in their implementation details, application areas and additional functions. Common to all is the ability to execute Java bytecode according to the standard “Java Virtual Machine Specification”. The most important JVMs include:

  • hotspot: The reference implementation of Oracle and is part of the Oracle Java platform including the open sourve version OpenJDK.
  • GraalVM: A new JVM from Oracle. It understands not only Java bytecode, but also the bytecode of the compiler system LLVM. Therefore, it can also run programs written in LLVM compatible languages such as C/C++, Julia, Rust and many others.
  • OpenJ9: Eclipse’s JVM is designed for performance and scalability. Originally developed by IBM, today the Eclipse Foundation is responsible for the project.
  • JamVM: Implements a very small JVM, which is used on some ARM systems, for example.
  • DalvikVM: The DalvikVM used on older Android devices is often counted among the JVMs. Strictly speaking, it is not, because it uses a different bytecode.


Ready to see us in action:

More To Explore

Enable registration in settings - general
Have any project in mind?

Contact us: