Corporate Training Study Material 2: Java Installation & Environment Setup

Rashmi Mishra
0

 

Corporate Training Study Material

Java Installation & Environment Setup

📌 Objectives:

By the end of this session, trainees will:
Understand how to install Java Development Kit (JDK).
Learn how to configure PATH and CLASSPATH.
Set up and explore Integrated Development Environments (Eclipse, IntelliJ IDEA, NetBeans).


1️ Introduction to Java Installation

Before writing and executing Java programs, we need to install Java Development Kit (JDK) and configure the environment.

1.1 What is JDK, JRE, and JVM?

Component

Description

JVM (Java Virtual Machine)

Runs Java bytecode (.class files) and provides platform independence.

JRE (Java Runtime Environment)

Includes JVM and libraries required to run Java applications.

JDK (Java Development Kit)

Includes JRE, compilers, and tools needed to develop Java programs.

📌 JDK is required for writing and compiling Java programs.


2️ Installing Java Development Kit (JDK)

2.1 Downloading and Installing JDK

1.   Visit Oracle JDK Download Page:
🔗 https://www.oracle.com/java/technologies/javase-downloads.html

2.   Download the latest JDK for your operating system (Windows, macOS, Linux).

3.   Run the installer and follow on-screen instructions.

4.   Verify installation:

o    Open Command Prompt (Windows) / Terminal (Mac/Linux) and type:

java -version

o    If installed correctly, it will display:

java version "17.0.2" (or latest version)

📌 Tip: You can also install OpenJDK from Adoptium or Amazon Corretto (free alternatives).


3️ Setting Up Environment Variables (PATH & CLASSPATH)

3.1 Why Set PATH and CLASSPATH?

  • PATH: Helps the system locate Java commands (javac, java) from any directory.
  • CLASSPATH: Tells Java where to find class files and libraries.

3.2 Configuring PATH on Windows

1.   Find JDK Installation Directory (e.g., C:\Program Files\Java\jdk-17\bin).

2.   Add it to PATH:

o    Windows 10/11:

§  Search "Environment Variables" → Click Edit System Variables.

§  Under System Variables, find PATH → Click Edit.

§  Click New, add:

C:\Program Files\Java\jdk-17\bin

§  Click OK → Restart Command Prompt.

3.   Verify:

o    Open CMD and type:

javac -version

o    Expected output:

javac 17.0.2

3.3 Configuring PATH on macOS & Linux

1.   Open Terminal and edit .bashrc or .zshrc:

nano ~/.bashrc  (or ~/.zshrc for macOS)

2.   Add:

export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/Home

export PATH=$JAVA_HOME/bin:$PATH

3.   Save and apply:

source ~/.bashrc   (or source ~/.zshrc)

4.   Verify:

java -version

📌 Tip: You can use echo %PATH% (Windows) or echo $PATH (Linux/macOS) to check if the PATH is set correctly.


4️ Installing and Using Java IDEs

To write and run Java programs efficiently, we use Integrated Development Environments (IDEs).

4.1 Popular Java IDEs

IDE

Description

Eclipse

Free, widely used, supports plugins for Java EE, Spring, etc.

IntelliJ IDEA

Feature-rich, good for professional developers.

NetBeans

Good for Java SE & EE development, open-source.


4.2 Installing Eclipse

1.   Download Eclipse from https://www.eclipse.org/downloads/

2.   Install Eclipse IDE for Java Developers.

3.   Launch Eclipse → Create a New Java Project.

4.   Write a simple Java program:

public class Hello {

    public static void main(String[] args) {

        System.out.println("Hello, Java Corporate Training!");

    }

}

5.   Click Run to execute the program.


4.3 Installing IntelliJ IDEA

1.   Download IntelliJ IDEA from https://www.jetbrains.com/idea/

2.   Install and launch the IDE.

3.   Create a New Java Project → Write a Java program.

4.   Click Run .


4.4 Installing NetBeans

1.   Download NetBeans from https://netbeans.apache.org/download/

2.   Install NetBeans and create a New Java Project.

3.   Write and execute Java programs.

📌 Tip: IntelliJ IDEA (Community Edition) is best for beginners, while Eclipse is ideal for enterprise projects.


5️ Summary 

JDK is essential for Java development.
Always set PATH and CLASSPATH properly.
Use an IDE (Eclipse, IntelliJ, NetBeans) for efficiency.
Regularly update Java to stay secure.


💡 Practical Hands-on Exercise

🎯 Task 1: Install Java and Verify Installation

1.   Install JDK (Oracle/OpenJDK).

2.   Set up PATH and CLASSPATH.

3.   Run java -version and javac -version.

🎯 Task 2: Write and Run a Java Program

1.   Open an IDE (Eclipse, IntelliJ).

2.   Create a New Java Project.

3.   Write this program:

public class Test {

    public static void main(String[] args) {

        System.out.println("Java Training is Live!");

    }

}

4.   Run the program.


📝 Frequently Asked Questions (FAQs)

Q1: Do I need JDK if I only want to run Java applications?

A: No, you only need JRE to run Java applications. But for development, JDK is required.

Q2: What is the difference between OpenJDK and Oracle JDK?

A: OpenJDK is open-source, while Oracle JDK includes commercial support. Both are functionally similar.

Q3: How do I check if Java is installed?

A: Run java -version in Command Prompt or Terminal.

Q4: Why do we set PATH in Java?

A: So that javac and java commands work from any location in the system.


📌 Additional Resources


📌 PowerPoint Presentation (PPT) Outline

Slide 1: Title Slide

  • Title: Java Installation & Environment Setup
  • Subtitle: Corporate Training Session
  • Trainer Name & Date

Slide 2: Agenda

🔹 Introduction to JDK, JRE, and JVM
🔹 Installing Java Development Kit (JDK)
🔹 Configuring PATH and CLASSPATH
🔹 Setting up Java IDEs (Eclipse, IntelliJ, NetBeans)
🔹 Running a Sample Java Program


Slide 3: Java Development Kit (JDK) Overview

🟢 JDK: Contains JRE + Development Tools
🟢 JRE: Runs Java applications
🟢 JVM: Converts Java bytecode into machine code

📌 Diagram: JVM → JRE → JDK


Slide 4: Downloading & Installing JDK

  • Step 1: Visit Oracle JDK
  • Step 2: Select OS (Windows, macOS, Linux)
  • Step 3: Install and follow instructions

📌 Screenshot of JDK Download Page


Slide 5: Setting Up Environment Variables (PATH & CLASSPATH)

  • Why? To access Java commands (javac, java) from any directory
  • How?
    • Windows: Add C:\Program Files\Java\jdk-XX\bin to PATH
    • Mac/Linux: Update ~/.bashrc or ~/.zshrc

📌 Command Examples: java -version, javac -version


Slide 6: Java IDEs - Choosing the Right One

🔹 Eclipse - Best for large enterprise projects
🔹 IntelliJ IDEA - Best for modern Java development
🔹 NetBeans - Lightweight & simple

📌 Comparison Table


Slide 7: Installing and Using Eclipse

  • Step 1: Download from eclipse.org
  • Step 2: Install Eclipse IDE for Java Developers
  • Step 3: Open Eclipse → Create a Java Project
  • Step 4: Write & Run Java Program

📌 Screenshot of Eclipse Interface


Slide 8: Running Your First Java Program

public class Hello {

    public static void main(String[] args) {

        System.out.println("Welcome to Java Corporate Training!");

    }

}

Click "Run" in IDE or use terminal java Hello


Slide 9: Summary & Best Practices

Install the latest JDK
Properly configure PATH & CLASSPATH
Use an IDE for faster development
Always test installation with java -version

📌 Q&A Session


Slide 10: Thank You!

  • Feedback & Queries
  • Trainer Contact Info

🎥 Live Demo Ideas for Corporate Training

Demo 1: JDK Installation & Version Check

  • Step 1: Install JDK (Live demonstration)
  • Step 2: Run java -version and javac -version

Demo 2: Configuring PATH & CLASSPATH

  • Step 1: Show how to set PATH
  • Step 2: Demonstrate Java command execution from any folder

Demo 3: Writing & Running a Java Program

  • Step 1: Open Eclipse or IntelliJ IDEA
  • Step 2: Write a basic Java program
  • Step 3: Execute and display the output

Demo 4: Running Java Program Using Terminal

  • Step 1: Open terminal
  • Step 2: Navigate to Java file location
  • Step 3: Compile: javac Hello.java
  • Step 4: Run: java Hello

 

Tags

Post a Comment

0Comments

Post a Comment (0)