Java Setup & Installation
Before writing Java programs, you need to set up the Java Development Kit (JDK) and a code editor. This guide walks you through the complete setup process step by step. This is a foundational concept in enterprise application development that professional developers rely on daily. The explanations below are written to be beginner-friendly while covering the depth and nuance that comes from real-world Java experience. Take your time with each section and practice the examples
What You Need
- JDK (Java Development Kit) — The toolkit to write and compile Java programs
- A Code Editor — VS Code, IntelliJ IDEA, or Eclipse to write your code
- Terminal/Command Prompt — To compile and run Java programs
Step-by-Step Installation
1. Go to oracle.com/java/technologies/downloads and download JDK 21 (LTS) 2. Run the installer and follow the on-screen instructions 3. Set up the JAVA_HOME environment variable 4. Add Java to your system PATH 5. Open a terminal and type: java --version 6. You should see the Java version printed — Setup complete!
Verify Installation
// Open your terminal and type these commands:
// Check Java version
// Command: java --version
// Output: java 21.0.2 2024-01-16 LTS
// Check Java compiler version
// Command: javac --version
// Output: javac 21.0.2
// If you see version numbers, Java is installed correctly!
System.out.println("Java is installed!");
System.out.println("JDK version: 21.0.2");