Java Tutorials
  • Introduction to Java
    • What is Java?
    • History and Features of Java
    • Java Virtual Machine (JVM) and Bytecode
    • Why Java?
  • Setting up Java Development Environment
    • Installing Java Development Kit (JDK)
    • JDK vs JRE
    • Setting up IDE (Eclipse, IntelliJ, NetBeans) or Text Editor (VS Code, Sublime Text)
  • Basic Java
    • First Java Program : Hello World
    • Variable
    • Data Type
    • Constant
    • Date and Format
    • Operator
    • Condition
    • Looping
    • Function
    • Variadic Function
    • Enums
    • Array
    • Collection
    • Exception and Exception Handling
    • Naming Convention
  • Object Oriented Programming (OOP)
    • Classes and Objects
    • Inheritance and Polymorphism
    • Encapsulation and Abstraction
  • File Handling
    • Reading and Writing Binary File
    • Reading and Writing Text File
    • Serialization and Deserialization
  • Multithreading
    • Creating and Running Threads
    • Synchronization
    • Thread Pools and Executors
  • Collections API
    • Sorting and Comparable
    • Searching and Comparator
  • Java Database Connectivity (JDBC)
    • Introduction and Life Cycle
    • Connection to Database (MySQL)
    • Downloading JDBC Drivers for Various Databases
    • Maven and Gradle JDBC Drivers for Various Databases
    • JDBC URL Formats
    • Statement and PreparedStatement
    • CallableStatement
    • Selecting Data using JDBC
    • Inserting Data using JDBC
    • Updating Data using JDBC
    • Deleting Data using JDBC
    • Invoking Function and Stored Procedure using JDBC
  • Lambda
    • Introduction to Lambda Expressions
    • Functional Interface
    • Filtering, Mapping, Reducing
    • Lambda Expressions in Collections
    • Method References
    • Functional Programming Concepts
    • Stream API
    • Error Handling in Lambda Expressions
    • Optional in Functional Programming
    • Parallel Processing with Lambda
    • Functional Programming Patterns
    • Advanced Topics in Lambda Expressions
    • Best Practices and Design Patterns
    • Real-World Use Cases and Examples
Powered by GitBook
On this page
  1. Setting up Java Development Environment

Installing Java Development Kit (JDK)

Installing Java Development Kit (JDK) on Windows:

Step 1: Download JDK for Windows:

  • Visit the official Oracle website or an authorized distributor.

  • Choose the appropriate version for Windows and click on the download link.

  • Run the downloaded installer (usually a .exe file).

Step 2: Run the Installer:

  • Double-click the downloaded .exe file to run the installation wizard.

  • Follow the on-screen instructions. You might need administrative privileges to install the JDK.

Step 3: Set Environment Variables:

  • After installation, set the JAVA_HOME environment variable.

    • Right-click on 'This PC' or 'My Computer' and select 'Properties.'

    • Click on 'Advanced system settings.'

    • Click 'Environment Variables.'

    • Under 'System Variables,' click 'New' and add JAVA_HOME as the variable name and the JDK installation path as the variable value (e.g., C:\Program Files\Java\jdk1.8.0_221).

    • Find the 'Path' variable in the 'System Variables' section and click 'Edit.' Add %JAVA_HOME%\bin at the end of the variable value.

Step 4: Verify Installation:

  • Open Command Prompt and type java -version. It should display the installed Java version to confirm the successful installation.

Installing Java Development Kit (JDK) on MacOS:

Step 1: Download JDK for MacOS:

  • Visit the official Oracle website or use a package manager like Homebrew.

  • Download the appropriate .dmg file for MacOS.

Step 2: Run the Installer:

  • Double-click the downloaded .dmg file to mount the disk image.

  • Drag the JDK package icon to the Applications folder.

  • JDK is now installed on your MacOS.

Step 3: Set Environment Variables (Optional):

  • MacOS usually sets the necessary environment variables automatically, so manual configuration is often not needed.

Step 4: Verify Installation:

  • Open Terminal and type java -version. It should display the installed Java version to confirm the successful installation.

Installing Java Development Kit (JDK) on Linux:

Step 1: Use Package Manager (Example: Ubuntu):

  • Open Terminal.

  • Update the package index: sudo apt update

  • Install JDK: sudo apt install default-jdk

Step 2: Set Environment Variables (Optional):

  • Linux systems often set environment variables automatically after installation.

Step 3: Verify Installation:

  • Open Terminal and type java -version. It should display the installed Java version to confirm the successful installation.

By following these steps, you can install the Java Development Kit (JDK) on Windows, MacOS, and Linux-based systems, allowing you to develop Java applications on your preferred platform.

PreviousWhy Java?NextJDK vs JRE

Last updated 1 year ago