Java Virtual Machine

Java Virtual Machine

In this post we discuss the Java Virtual Machine in more detail to help familiarize you with the inner workings and hopefully give you a better understanding of Java. We will discuss what the Java Virtual Machine is, what the typical Java workflow is and some of the JVM languages which leverage the huge installed Java code base.

What’s Covered

  1. What is the Java Virtual Machine
  2. Typical Java Workflow
  3. JVM Languages
  4. Java Workflow using JVM Languages
  5. Well-Known JVM Languages
  6. JVM References

What is the Java Virtual Machine

The Java Virtual Machine is the centerpiece of the Java platform. The Java Virtual Machine or JVM is a software implementation of a computer. Its main job is to interpret “compiled” Java binary code (bytecode) so that it may run the Java program’s instructions on the host machine. The Java Virtual Machine itself is only familiar with bytecode and more specifically the binary format of class files. It has no knowledge of the Java language itself. As a matter of fact, if you created a new language that produced compatible bytecode for the JVM it work just fine.

Typical Java Workflow

In order for us to be able to run our high level Java code on the host system the Java source must go through the typical build process. During this build process our source code (*.java) files are converted to Java bytecode (often times in *.class files). At this point our code (bytecode) is in a state that is most portable to all environments that support the JVMs. This bytecode is an abstract machine language that is ultimately executed by the Java virtual machine.

When running our application on the host system we will pass our Java bytecode to the Java virtual machine. It must go through the class loader, which will loads all imports and dependencies and performs the linking and verification, and then properly initializes the variables to the proper starting values.

Now that our bytecode has gone through the Class Loader and Bytecode Verifier it is ready to get to the interpreter. The interpreter in JVM will begin compiling the bytecode at runtime using their just-in-time compilter (JIT compiler). This step may add a small delay during thre initial application startup but will generally improve the performance of the application when compared to the standard interpreted version.


JVM Languages

Java Workflow using JVM Languages

Nowadays, the Java Virtual Machine (JVM) isn’t just for Java anymore. There are hundreds of languages that produce JVM compatible bytecode in class files. The basic premise is that as long as you can produce bytecode that is compliant with the Java virtual machine specifications and produce (*.class) files we will be able to leverage the huge user installed base.


Well-Known JVM Languages

  • Scala
  • Groovy
  • Clojure
  • Ceylon
  • Jython
  • JRuby
  • Nashorn
  • Jacl
  • Fortress
  • Nice
  • X10

JVM References


Core Java Related Tutorials

Please Share Us on Social Media


Leave a Reply

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