Check if Java is installed, download and install Java, verify it, and run your first Java program using VS Code.
Video Tutorial: Install Java on Windows 10/11
Watch the complete step-by-step Java installation and first program execution.
Step 0: First Check Java in Terminal (Important)
Before downloading Java, always check if Java is already installed on your system.
- Press Windows + R
- Type cmd and press Enter
Run this command:
java -version
✔ Java version shown → Java already installed (skip download)
✖ 'java' is not recognized → Java not installed (continue below)
Step 1: Download Java from Oracle Website
Open your browser and visit the official Oracle Java download page:
https://www.oracle.com/java/technologies/downloads/
- Download Java SE (JDK)
- Select Windows x64 Installer (.exe)
Note: Always download Java only from the official Oracle website.
Step 2: Install Java (No Environment Variables Needed)
- Double-click the downloaded .exe file
- Click Next
- Keep default settings
- Click Install
✔ No need to set PATH or Environment Variables manually.
Step 3: Verify Java Installation
Open Command Prompt and run:
java -version
Example output:
java version "21.0.1" 2025-xx-xx
If the version appears → Java installed successfully 🎉
Step 4: Use Java in VS Code
Install VS Code:
https://code.visualstudio.com/
Install Java Extension:
- Open Extensions in VS Code
- Search: Extension Pack for Java
- Install it
Step 5: Create Your First Java Program
Create a file named first.java and paste the code below:
public class first {
public static void main(String[] args) {
System.out.println("Hello Java");
}
}Important: File name and class name must be the same.
Step 6: Run Java Program
Open terminal in the file folder and run:
javac first.java java first
Output:
Hello Java
✔ Java is working perfectly.
Summary (Simple Flow)
- Check Java →
java -version - Download Java from Oracle
- Install using default options
- Verify Java again
- Open VS Code
- Create
first.java - Run and see output
