Java Installation & Setup
Installing Java Development Kit (JDK)
To begin Java programming, you must install the Java Development Kit (JDK). It includes:
google.com, pub-8434817042454839, DIRECT, f08c47fec0942fa0
- Java compiler (
javac) - Java runtime (
java) - Development tools
Steps to install JDK:
- Download JDK from the official Oracle website
- Run the installer
- Choose installation directory
- Complete installation
Setting Up Environment Variables
After installing JDK, you need to configure environment variables.
JAVA_HOME
Points to the JDK installation directory.
Example:
C:\Program Files\Java\jdk-21
PATH Variable
Add the bin folder of JDK to PATH:
C:\Program Files\Java\jdk-21\bin
This allows running Java commands from any terminal.
Understanding JDK, JRE, JVM
JDK (Java Development Kit)
- Full toolkit for development
- Includes compiler and tools
JRE (Java Runtime Environment)
- Required to run Java programs
- Includes JVM and libraries
JVM (Java Virtual Machine)
- Executes Java bytecode
- Makes Java platform-independent
How Java Works (Execution Flow)
- Write Java code (.java file)
- Compile using
javac→ bytecode (.class file) - Run using JVM → output displayed
Common Setup Errors and Fixes
- Java not recognized: Check PATH variable
- Wrong version: Verify JAVA_HOME
- Compilation error: Check syntax

