Post

Introduction to Java and Installation Guide

Introduction to Java and Installation Guide

What is Java?

Java is a robust, high-level programming language developed by Sun Microsystems (now Oracle). Known for its “Write Once, Run Anywhere” capability, Java powers everything from mobile apps to enterprise software.

Key Features of Java

  1. Platform Independence
    • Runs on any device with a JVM
    • True “Write Once, Run Anywhere” functionality
    • Bytecode compatibility across platforms
  2. Object-Oriented
    • Built around classes and objects
    • Supports inheritance, encapsulation, and polymorphism
    • Promotes modular and reusable code
    • Interface and abstract class support
  3. Security & Reliability
    • Strong type checking
    • Automatic memory management
    • Exception handling
    • Security manager for runtime checks
    • No pointer arithmetic
    • Bytecode verification
  4. Performance
    • JIT (Just-In-Time) compilation
    • Multi-threading support
    • Optimized bytecode execution
    • Garbage collection
    • HotSpot optimization
  5. Rich Standard Library
    • Extensive built-in APIs
    • Collections framework
    • Network programming utilities
    • Database connectivity
    • GUI development tools

Installation Guide

1. Download JDK

  • Visit Oracle’s Java Downloads
  • Select your operating system (Windows, macOS, or Linux)
  • Download the latest LTS (Long Term Support) version
  • Choose the appropriate architecture (x64, ARM)

2. Installation Steps

Windows:

  1. Double-click the downloaded .exe file
  2. Accept license agreement
  3. Choose installation directory
  4. Wait for installation to complete
  5. Click ‘Close’ when finished

macOS:

  1. Open the downloaded .dmg file
  2. Double-click the package installer
  3. Follow the installation wizard
  4. Enter administrator password when prompted
  5. Wait for completion

Linux:

  1. Open terminal
  2. Extract the downloaded archive:
    1
    
     tar -xvf jdk-[version].tar.gz
    
  3. Move to /opt directory:
    1
    
     sudo mv jdk-[version] /opt/java
    

3. Configure Environment Variables

Windows:

  1. Open System Properties → Advanced → Environment Variables
  2. Create new System Variable:
    • JAVA_HOME = C:\Program Files\Java\jdk-[version]
  3. Add to Path:
    • %JAVA_HOME%\bin

Linux/Mac:

Add to ~/.bashrc or ~/.zshrc:

1
2
export JAVA_HOME=/opt/java
export PATH=$PATH:$JAVA_HOME/bin

4. Verify Installation

Open terminal/command prompt:

1
2
java --version    # Shows Java runtime version
javac --version   # Shows Java compiler version

First Java Program

1
2
3
4
5
public class HelloWorld {
     public static void main(String[] args) {
          System.out.println("Hello, Java World!");
     }
}

How to Run

  1. Save as HelloWorld.java
  2. Compile: javac HelloWorld.java
  3. Run: java HelloWorld

Next Steps

  • Set up an IDE (VS Code, Eclipse, or IntelliJ)
  • Learn Java syntax and concepts
  • Practice with simple programs
  • Join Java communities

This post is licensed under CC BY 4.0 by the author.