Step-by-Step Java Installation Guide

Sep 4, 2024

Java Installation and "Hello World" Program Guide

Introduction

  • Welcome message and Happy New Year.
  • Purpose of the video: Install Java and run a simple "Hello World" program on Windows OS.
  • Encouragement to comment for help and subscribe to related channels:
    • Geeky Syntax (programming and coding videos)
    • Geeky Script Vlogging Channel

Installing Java

  1. Search for JDK
    • Type "jdk download" in the search bar.
    • Open the link to the official Oracle site (link in description).
  2. Download Java JDK
    • Select the appropriate version (e.g., JDK 21).
    • For Windows, download the x64 MSI Installer.
  3. Install Java
    • Double-click the downloaded file to launch the installation wizard.
    • Follow the prompts (Next, Yes) to install in the default directory (C:\Program Files\Java\jdk21).
    • Installation may take a few minutes.

Setting Environment Variables

  1. Locate JDK Installation
    • Navigate to C:\Program Files\Java\jdk21\bin and copy the path.
  2. Edit System Environment Variables
    • Search for "environment" and select "Edit the system environment variables".
    • Click on the "Environment Variables" button.
    • Edit the "Path" variable:
      • Click on New and paste the copied path.
    • Set JAVA_HOME variable:
      • Variable name: JAVA_HOME
      • Variable value: C:\Program Files\Java\jdk21 (without \bin).

Verifying Installation

  • Open Command Prompt and type java --version.
  • Successful installation will show the installed Java version.

Creating a "Hello World" Program

  1. Create a New Folder
    • Name it Java Practice.
  2. Create a New Java File
    • Create a new text document and rename it to HelloWorld.java.
    • Enable file name extensions if not visible by going to View > Show > File name extensions.
  3. Write Java Code
    • Open HelloWorld.java in Notepad and enter code:
      class HelloWorld {
          public static void main(String[] args) {
              System.out.println("Hello, World!");
          }
      }
      
    • Save the file.
  4. Compile and Run the Program
    • In the Java Practice folder, open Command Prompt and compile using javac HelloWorld.java.
    • Run the program with java HelloWorld to see the output in the console.

Recommendations

  • Install IntelliJ IDEA for a better programming environment with a graphical user interface.

Conclusion

  • Encourage viewers to like, share, and subscribe to both Geeky Script and Geeky Syntax channels.
  • Thank the audience and provide well wishes.