What Is Java Virtual Machine?

What does java virtual machine really means?

java virtual machine cross platform

A Java Virtual Machine or might also be known as JVM, is a software program which executes codes and provides a runtime environment for it. JVM enables a computer to run Java programs as well as programs from other languages that are compiled into Java bytecode.

JVM or Java Virtual Machine can actually execute codes other than Java language itself. At first, you might think that the JVM is specifically used for Java language. But, in reality, there are other programming languages that use the JVM as its runtime environment.

There are many programming languages that use Java virtual machine. Including old languages that are ported to JVM and completely new languages. For ported language, we can take a look at JRuby and Jython which is ported from an existing language that is Ruby and Python. For new languages, we can take a look at Clojure, Groovy, Scala and, Kotlin.

A key feature of the JVM languages is that they are compatible with each other. So, for example, Kotlin libraries can be used by Java programs and vice versa.

Use of JVM

There are mainly two primary functions for the Java Virtual Machine.

First, is to run a program/software in every device or operating system (It can be known as the: “write once, run anywhere” principle). Back when Java was released in 1995, programming language was written to a specific operating system.

We can abbreviate the write once, run anywhere principle as WORA. Now, when a program has WORA capability, then it should work on almost every platform like; Windows, Mac OS, Linus, Solaris, Android, NetWare or any other OS or platform. Neglecting whether the physical machine is a notebook, a mainframe, a desktop, an android, or a tablet device.

But in order to use a program in that much of a platform, it needs to meet requirements. In this case, the platform which you use should have its own version of JVM built-in.

Second, is to manage and optimize system memory automatically. Back then our predecessor programmer has to manage program memory on their own.

Before Java, programmers are the one who is in charge of managing program memory. In Java, program memory is managed by the Java Virtual Machine. JVM memory manages all of those program memory using process called garbage collection.

You might think that garbage collections mean finding and deleting garbage from system memory. While in reality, garbage collections track each and every available object in the JVM and remove unused ones.

Now, garbage collections have two functionality :

  1. Mark: It tracks every object and mark every object found as alive, identifies which memory are in use and which is not.
  2. Sweep: All the heap memory which is not used by objects are reclaimed. And eventually swept free of unused objects.

JVM Future

For once JVM was created originally for Java, but now it has evolved to support many other programming languages as mentioned above. And by that, we can see a bright and clear future which JVM is prominent in the Development world.

The programming language that I specialize in is Java, because I think Java programming language is more universal and of course because I like it regardless of any reason.

Published by

Rafif Santika

The programming language that I specialize in is Java, because I think Java programming language is more universal and of course because I like it regardless of any reason.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.