Java Zero to All All questionsPractise free
Interview questions › Java Foundations — Zero to Basics › How Java Runs — JDK, JRE, JVM & Your First Program

What is the difference between the JDK, the JRE and the JVM?

Level I · BeginnerHow Java Runs — JDK, JRE, JVM & Your First Program
Short answer

The JVM (Java Virtual Machine) is the engine that actually executes Java bytecode; there is a different JVM implementation per operating system, which is what makes Java portable.

Explanation

The JRE (Java Runtime Environment) is the JVM plus the standard class libraries needed to RUN a Java application. The JDK (Java Development Kit) is the JRE plus the development tools you need to BUILD applications -- the compiler javac, the jar tool, javadoc, the debugger and so on. To write Java you install a JDK; to only run a finished app you historically needed just a JRE (modern distributions usually ship a full JDK).

Common mistakes
  • Saying the JRE and JDK are the same thing, or that you need the JDK only for 'big' projects.
  • Forgetting that the JVM is platform-specific even though bytecode is not.

Can you say this out loud in two minutes? Drill it in a timed mock interview, with flashcards and runnable code for How Java Runs — JDK, JRE, JVM & Your First Program.

Practise free

More on How Java Runs — JDK, JRE, JVM & Your First Program