SteelReed

Search

Search posts, questions…

Java CoreQuestion 1 / 43

Junior

What is the difference between JDK, JRE and JVM? How does a Java program go from source to main?

Short answer

The JVM runs bytecode. The JRE = JVM + standard library. The JDK = JRE + build tools like javac.

javac, part of JDKjava Greetinghot codeGreeting.javaGreeting.class: bytecodeJVM: ClassLoader loadsverifier checksInterpreter runs mainJIT compiles to machinecode

3 points to say:

  1. JDK to write, JRE to run, JVM executes.
  2. javac makes bytecode that runs wherever a JVM runs.
  3. A server running a JAR only needs a runtime (-jre image).

Keep reading the deep dive

Create a free account to read the full explanation and follow-up questions, mark questions as studied and review them on a schedule.