Java Documentation

Java Setup & Installation

Before diving into advanced Java programming, it is essential to set up a proper development environment. This page guides you through installing Java on different operating systems, choosing a suitable code editor or IDE, and running your first Java programs confidently.

Java Development Kit (JDK)

The Java Development Kit (JDK) is required to develop and run Java applications. It includes the Java compiler (javac), Java Virtual Machine (JVM), and standard libraries.

Recommended version for this course: JDK 17 (LTS)

Installing Java on Different Operating Systems

Windows

  • Download JDK from Oracle or OpenJDK distribution.
  • Run the installer and follow on-screen instructions.
  • Add Java to system PATH automatically (recommended).
  • Restart the system after installation.

Linux (Ubuntu / Debian-based)

sudo apt update
sudo apt install openjdk-17-jdk

Verify installation using the terminal.

macOS

Install using Homebrew (recommended).

brew install openjdk@17

Verifying Java Installation

Open a terminal or command prompt and run:

java -version
javac -version

If Java is installed correctly, version information will be displayed.

Choosing a Code Editor or IDE

Selecting the right development environment improves productivity and learning.

Recommended IDEs

  • IntelliJ IDEA – Industry standard, powerful features
  • Eclipse – Popular academic and open-source IDE
  • NetBeans – Simple, beginner-friendly

Code Editors

  • VS Code – Lightweight with Java extensions
  • Neovim / Vim – Terminal-based, advanced users

How Java Programs Are Compiled and Run

Java programs follow a two-step execution process:

  1. Compilation using javac
  2. Execution using java
javac HelloWorld.java
java HelloWorld

The compiler converts source code into bytecode, which is executed by the JVM. This makes Java platform-independent.

"Now You are ready to write and run your first Java program!"