Java Programming Environments

Demystifying JDK, JRE, Command Line, and IDEs

How Java Components Fit Together

JDK (Java Development Kit)

Purpose: For Writing & Developing Java Applications.

Contains: Compiler (javac), Debugger, Documentation tools + JRE

JRE (Java Runtime Environment)

Purpose: For Running Pre-compiled Java Applications.

Contains: Class Libraries, Core Files + JVM

JVM (Java Virtual Machine)

Executes the raw bytecode on your specific operating system machine. It provides true platform independence.

JDK

The Developer's Toolbox

  • Used by software developers to build applications.
  • Contains development tools like javac (compiler).
  • Crucial when working inside an IDE to write code.
  • An absolute superset (Contains JRE + Tools).

JRE

The User's Execution Package

  • Used by end-users who just want to execute a Java app.
  • Does not contain a compiler; cannot turn source code into running apps.
  • Contains the vital core library classes required to read data.
  • Sufficient for standalone computers running client software.

Practical Example: Hello World

How your code interacts with these environments dynamically depending on your workflow choice:

public class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello, World!"); // Your Java App code
    }
}
Option A: Command Line Execution (Manual Workflow)

To run this code manually using purely the JDK Tools via Command Prompt / Terminal:

  1. Compile Code (Requires JDK): Convert human-readable text into Java Bytecode (.class file).
    $ javac HelloWorld.java
  2. Run Code (Requires JRE/JVM): Launch the compiled file.
    $ java HelloWorld
💡 Modern IDE Workflow Choice (Eclipse, IntelliJ, VS Code): An IDE combines text editing, automated JDK compilation, and JRE execution into a single "Run" button click. It completely manages the command line strings for you behind the scenes!