JVM, JDK, JRE: What's the difference?

Three indispensable Java platform components, and how they work together in your Java applications

JavaWorld staff Mar 12th 2019

Developers new to Java often wonder what differentiates the Java Virtual Machine, the Java Development Kit, and the Java Runtime Environment. They're also curious how these three Java platform components work together in Java applications. Finally, developers need to know how they will interact with each component.

Briefly:

  • The JVM is the Java platform component that executes your programs.
  • The JRE creates the JVM and ensures dependencies are available to your programs.
  • The JDK allows you to create Java programs that can be executed and run by the JVM and JRE.

As a developer, you'll work with the JDK to write your applications and with the JVM to debug and optimize them, especially for performance. The JRE mostly runs in the background, but you may use it for application monitoring and memory configuration.

That's the overview, but there's a lot more to know about each platform component.

Downloading and installing the JVM, JDK, and JRE

Anytime you download a JDK, it will include a version-compatible JRE, and that JRE will include a default JVM. You also can download the JRE separately from the JDK, and you may choose from a variety of JVMs.

PART 1:
What is the Java Virtual Machine?

Technically, the JVM is a specification, describing the requirements for building a piece of software. From a developer's perspective, it's how we run our Java programs. You can choose from a variety of JVM implementations, and it's important to know how to load and execute class files using the JVM you choose. You also should know how to check and tune JVM memory usage. 

PART 2:
What is the Java Development Kit?

The JDK is the package of tools you need to develop Java-based software. There isn't just one JDK, though, and it's important to know how to choose and download the correct JDK for the type of application you want to create. 

PART 3:
What is the Java Runtime Environment?

The JRE is the runtime environment for Java, which means it's a piece of software that is designed to run Java code. While the JRE mostly runs in the background, it's important to know how to use JRE flags and switches to configure application memory.