💻

How to Download, Install, and Run Java 22 on Windows 11

Jul 8, 2024

How to Download, Install, and Run Java 22 on Windows 11

Introduction

  • Video by Amit Things on installing Java 22 on Windows 11.
  • Steps include downloading, installing, setting up environment variables, and running the first Java program.

Downloading Java 22

  • Step 1: Open a web browser (Chrome used in the video).
  • Step 2: Search for "Oracle Java" and open the official Oracle website.
  • Step 3: Navigate to the top right and click on "Download Java".
  • Step 4: Scroll down to find the Java JDK 22 version.
  • Step 5: Choose the Windows 64-bit .exe file and initiate the download (164 MB).

Installing Java 22

  • Step 1: Right-click the downloaded .exe file and select "Open".
  • Step 2: Follow the installation wizard (Keep default C: drive path).
  • Step 3: Click "Next" and complete the installation.
  • Step 4: Click "Close" after installation is complete.

Setting Java Path Environment Variables

  • Step 1: Navigate to C:\Program Files\Java\[Java Version]\bin.
  • Step 2: Copy the bin folder path.
  • Step 3: Go to Start and search for "Environment Variables".
  • Step 4: Select "Edit the system environment variables".
  • Step 5: Click on "Environment Variables" button.
  • Step 6: Find the "Path" variable under System Variables and double-click it.
  • Step 7: Click "New" and paste the bin folder path.
  • Step 8: Confirm with multiple "OK" clicks to apply changes.

Verifying Java Installation

  • Step 1: Open Command Prompt (CMD).
  • Step 2: Type java --version and press Enter.
  • Step 3: If Java version info is shown, the installation is successful.

Writing and Running the First Java Program

  • Step 1: Open any drive (e.g., D: drive) and create a new text document.
  • Step 2: Rename the file extension from .txt to .java (e.g., studiopia.java).
  • Step 3: Ensure file extensions are visible via View > Show > File Name Extensions.
  • Step 4: Right-click the .java file and open with Notepad or Notepad++.
  • Step 5: Write the Java program: public class studiopia { public static void main(String[] args) { System.out.println("Amit Thean"); } }
  • Step 6: Save the file.
  • Step 7: Go to Command Prompt and switch to the drive containing the .java file (e.g., D:).
  • Step 8: Compile the Java program using javac studiopia.java.
  • Step 9: Run the compiled program using java studiopia.
  • Step 10: Output should display the printed message (e.g., Amit Thean).

Additional Resources

  • For a complete Java tutorial, visit the Studiopia website.