Downloading and Installing JDK on Mac

This section describes how to download and install JDK on a macOS computer.

To learn JDBC, you need to have JDK installed on your computer. If you are Mac user, you can follow what I did to download and install JDK 21 on your Mac computer.

1. Go to Oracle Java SE download website at

2. Click "JDK 21 > macOS" tab.

3. Click on the "jdk-21_macos-x64_bin.dmg" link in the "x64 DMG Installer" line to download the installation file to your "Downloads" directory.

4. Double-click on the "jdk-21_macos-x64_bin.dmg" file to install it.

To test the installation, open a command window to try the java command.

herong$ java -version
java version "21.0.2" 2024-01-16 LTS
Java(TM) SE Runtime Environment (build 21.0.2+13-LTS-58)
Java HotSpot(TM) 64-Bit Server VM 
  (build 21.0.2+13-LTS-58, mixed mode, sharing)

Cool, I have successfully installed JDK 21 on my macOS computer!

Table of Contents

 About This Book

 JDBC (Java Database Connectivity) Introduction

JDK (Java SE) Installation

 Downloading and Installing JDK on Windows

 Adding JDK "bin" Directory to Path Setting

Downloading and Installing JDK on Mac

 Downloading and Installing JDK on Linux

 Compile and Run Java Programs

 -cp or -classpath Syntax on Different Systems

 JDK Documentation Installation

 Installing and Running Derby (Java DB)

 Derby (Java DB) JDBC Driver

 Derby (Java DB) JDBC DataSource Objects

 Derby (Java DB) - DML Statements

 Derby (Java DB) - ResultSet Objects of Queries

 Derby (Java DB) - PreparedStatement

 Summary of JDBC Drivers and Database Servers

 Using Connection Pool with JDBC

 Archived Tutorials


 Full Version in PDF/EPUB