Java Overview & Environment Setup (JDK 21)

What Java is, why it dominates backend development, how the JVM works, and a step-by-step JDK installation with your first Hello World program.

BeginnerUpdated 2026-10-30126K views

Why Learn Java for Backend Development

Java is a strongly typed, object-oriented language that runs on the Java Virtual Machine (JVM). Write once, run anywhere: the same compiled bytecode runs on Windows, Linux and macOS, which made Java the default choice for enterprise backend systems since the late 1990s.

  • Huge ecosystem: Spring Boot, MyBatis, Kafka, Hadoop, Elasticsearch are all JVM-first.
  • Strong engineering: static typing, mature tooling, excellent IDE support (IntelliJ IDEA).
  • High performance: the JIT-compiled JVM is far faster than most interpreted languages.
  • Job market: banks, e-commerce, telecom and government systems run on Java everywhere.

How the JVM Works

Java source files (.java) are compiled by javac into bytecode (.class), which the JVM interprets and Just-In-Time compiles to native machine code at runtime. The JVM also manages memory: objects live in the heap, garbage collection (GC) reclaims unused objects automatically.

# 编译与运行全过程
javac Hello.java     # 源码 -> 字节码 Hello.class
java Hello           # JVM 启动,加载并执行字节码

# 查看 JDK 版本
java -version
javac -version
JDK vs JRE: JDK (Java Development Kit) includes javac and other tools and is what developers install; JRE only runs Java programs and is enough for production servers.

Installing the JDK

Download a JDK build from your provider of choice — Oracle JDK, OpenJDK, Amazon Corretto, Eclipse Temurin or Alibaba Dragonwell all work. LTS versions are 8, 11, 17 and 21; new projects should start on 21.

# Windows: 下载 zip 解压后设置环境变量
setx JAVA_HOME "C:\Program Files\Java\jdk-21"
setx PATH "%JAVA_HOME%\bin;%PATH%"

# Linux (apt / yum)
sudo apt install openjdk-21-jdk
java -version   # 验证安装

Verify the installation with java -version and javac -version in a new terminal. Then pick an IDE: IntelliJ IDEA Community Edition is free and the industry standard; VS Code with the Java extension pack also works well.

Your First Java Program

public class Hello {
    public static void main(String[] args) {
        System.out.println("Hello, BackendWiki!");
    }
}
  • The file must be named Hello.java, matching the public class name exactly.
  • main is the entry point; String[] args receives command-line arguments.
  • Compile with javac Hello.java, run with java Hello.
From Java 16+ you can run single-file programs directly with java Hello.java without compiling first — handy for quick experiments.

What to Learn Next

  1. Core syntax: variables, control flow, methods in this tutorial series.
  2. Object-oriented programming: classes, inheritance, interfaces.
  3. Collections Framework: List, Set, Map and generics.
  4. Concurrency: threads, thread pools, CompletableFuture.
  5. Ecosystem: Maven/Gradle build, Spring Boot framework, databases, microservices.

Friends & Partners