Sub topic 1
What the JDK Does
The JDK, compiler, and runtime
Java is a programming language: a way to write instructions for a computer. To create and run Java programs, you need a Java Development Kit (JDK). It is a set of tools for working with Java.
A Java program starts as source code, which is text written by a person. The JDK includes two important tools:
- The compiler changes source code into bytecode. Bytecode is a form that the Java runtime can understand.
- The runtime runs the bytecode on your computer.
You need the JDK to compile programs, not just run them.
Open a terminal and navigate to a folder
A terminal is a window where you type commands for your computer. A command is an instruction you give it.
On Windows, open PowerShell from the Start menu. On macOS, open Terminal from Applications. On Linux, open your Terminal app.
A folder, also called a directory, holds files. Your working directory is the folder your terminal is using now.
Type these commands one at a time. They work in PowerShell and in common macOS and Linux terminals.
cd ~
mkdir java-practice
cd java-practice
pwdThe first command takes you to your home folder. The second creates a folder named java-practice, and the third moves into it. If that folder already exists, skip the mkdir command. The last command shows your working directory.
Choose a JDK for your computer
Choose a download that matches these details:
- Operating system: the main software that manages your computer, such as Windows, macOS, or Linux.
- Architecture: the type of processor your computer uses. Common choices are x64 and ARM64.
- Version: the numbered release of the JDK.
On Windows, look under Settings, System, About for the system type. On a Mac, open About This Mac: an Apple chip uses ARM64, while an Intel chip uses x64. On Linux, run uname -m; x86_64 means x64, and aarch64 means ARM64.
If a course or project names a JDK version, choose that one. Otherwise, JDK 21 or 25 is a reasonable choice. Both are long-term support releases, meaning they receive updates for an extended period, depending on the provider.
Choose a trusted provider, such as Eclipse Adoptium, and select the download for your system and architecture.
Exercise
Your computer runs Windows on an x64 processor. Which system and architecture should you select for a JDK download?
Show answer
Select Windows and x64.