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
- Platform Independence
- Runs on any device with a JVM
- True “Write Once, Run Anywhere” functionality
- Bytecode compatibility across platforms
- Object-Oriented
- Built around classes and objects
- Supports inheritance, encapsulation, and polymorphism
- Promotes modular and reusable code
- Interface and abstract class support
- Security & Reliability
- Strong type checking
- Automatic memory management
- Exception handling
- Security manager for runtime checks
- No pointer arithmetic
- Bytecode verification
- Performance
- JIT (Just-In-Time) compilation
- Multi-threading support
- Optimized bytecode execution
- Garbage collection
- HotSpot optimization
- 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:
- Double-click the downloaded
.exe
file - Accept license agreement
- Choose installation directory
- Wait for installation to complete
- Click ‘Close’ when finished
macOS:
- Open the downloaded
.dmg
file - Double-click the package installer
- Follow the installation wizard
- Enter administrator password when prompted
- Wait for completion
Linux:
- Open terminal
- Extract the downloaded archive:
1
tar -xvf jdk-[version].tar.gz
- Move to /opt directory:
1
sudo mv jdk-[version] /opt/java
3. Configure Environment Variables
Windows:
- Open System Properties → Advanced → Environment Variables
- Create new System Variable:
- JAVA_HOME = C:\Program Files\Java\jdk-[version]
- 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
- Save as
HelloWorld.java
- Compile:
javac HelloWorld.java
- 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.