JDK, JRE and JVM
JVM (Java Virtual Machine)
The JVM is an abstract machine that loads, verifies and executes bytecode. It also manages memory (heap, stack) and performs garbage collection.
JRE (Java Runtime Environment)
JRE = JVM + class libraries. It provides everything needed to run a Java program.
JDK (Java Development Kit)
JDK = JRE + development tools such as javac (compiler), java (launcher), javadoc and jdb (debugger). It's what you need to write and compile programs.
RememberJDK ⊃ JRE ⊃ JVM
How a Java Program Runs
- You write source code in
Main.java. javac Main.javacompiles it to bytecode:Main.class.java Mainstarts the JVM, which loads, verifies and executes the bytecode.
javac Main.java
java Main
Hello, Java!
Track your progress through the Java course