Java Development Kit, Runtime Environment and Virtual Machine

Nemanja Žunić
Java Vault
Published in
3 min readApr 19, 2018

Before going into any Java Language, or Object Oriented concepts, I think it’s important to have an understanding of the environment in which Java code is written and executed.

Most of the new developers followed some “setting up the environment” manuals which instructed them to download and install Java Development Kit and Eclipse or IntelliJ IDE. All of the sudden they could write programs in IDE and execute them with a click of the (play) button.

While Java Application Execution Process deserves a post of its own (I might do it in the future), in this post, I would like to focus on the Java Development Kit that is required for Java Application development and execution.

Java Development Kit

Java Development Kit(JDK) contains:

  • tools for developing, debugging and monitoring Java applications
  • Java Runtime Environment

JDK is used only by the Java developers. End users have no use of the tools that come with it.

Some of the tools JDK contains are:

  • javac — Java compiler that converts code written in Java to Java Bytecode
  • java — Application Loader that loads Java Bytecode into the memory
  • jdb — Java Debugger that helps you find and fix bugs in Java code
  • javadoc — Documentation Generator that transforms your Java comments into a neat documentation of your application
  • jar — Archiver that takes all your application files and packages them into a single .jar file which can be easily distributed (think of .zip files)
  • plus many more
Java Development Kit contents

Java Runtime Environment

Java Runtime Environment(JRE) is an environment for running Java applications. This is what the end users install if they want to run Java applications on their machine.

Java Runtime Environment contains:

  • Java Libraries required to run Java applications
  • Java Virtual Machine

Some of the libraries JRE contains are:

  • User Interface toolkits — Swing, AWT, Java 2d, …
  • Integration libraries — Java Database Connectivity (JDBC), Remote Method Invocation (RMI), …
  • Other base libraries — Input/Output, Math, Networking, …
Java Runtime Environment contents

Java Virtual Machine

Java Virtual Machine(JVM) is an environment in which our applications are executed. JVM is a Process Virtual Machine, meaning that it contains a single application, it is created when that application is started and is destroyed when the application exits.

When using JVM we do not care about the Operating System or the Hardware we have. JVM allows us to run the same Java application on different platforms, say Windows and Ubuntu, as long as both of the machines have JVM (through JRE or JDK ).

Now you must be wondering how can the same JVM run apps on two different platforms. The answer is — it can’t. There is something called JVM specification which is just a broad description of the requirements. And there are multiple JVM implementations that satisfy the requirements of the specification. By satisfying the JVM specification requirements, implementations are able to run Java apps. Aside from implementing the specification, each JVM implementation has some characteristics of its own. So, one JVM might execute Java code on Android, another could do the same on Windows, third has a different Garbage Collector etc.

JVM Specification and implementations example

Epilogue

Hope you find the post informative and helpful. It’s my first post on the subject, and technical post in general so please feel free to leave a comment or a suggestion. Let’s learn and grow together 😄

--

--

Nemanja Žunić
Java Vault

I write sentences that make the magic happen (software developer, basically the same thing).