Installation Steps
Windows
- Download JDK
- Go to the official site: Oracle Corporation or OpenJDK (Adoptium)
- Download the Windows x64 Installer (.exe)
- Install Java
- Double-click the downloaded .exe file
- Follow the setup wizard (Next → Install → Finish)
- Set Environment Variables
- Open: System Properties → Advanced → Environment Variables
Add:
- JAVA_HOME → Path where JDK is installed
- Example: C:\Program Files\Java\jdk-21 - Edit Path → Add: %JAVA_HOME%\bin
- Open: System Properties → Advanced → Environment Variables
Add:
- Verify Installation
- Open Command Prompt and run:
java -versionjavac -version
- Open Command Prompt and run:
Mac/Linux
-
Download JDK
- From Oracle Corporation or OpenJDK (Adoptium)
- Download macOS (.dmg or .pkg)
-
Install Java
- Open the .dmg / .pkg file
- Follow installation instructions
-
Set Environment Variables (Optional but Recommended)
- Open Terminal and edit:
nano ~/.zshrc- Add:
export JAVA_HOME=$(/usr/libexec/java_home)
export PATH=$JAVA_HOME/bin:$PATH- Apply changes:
source ~/.zshrc -
Verify Installation
- Open the Terminal and run:
java -version
javac -version
Install Java using Homebrew (macOS)
-
Install Homebrew (if not installed)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" -
Install OpenJDK
brew install openjdk -
Set Environment Variables Add to
~/.zshrc (or ~/.bashrc):export JAVA_HOME=$(/usr/libexec/java_home)
export PATH=$JAVA_HOME/bin:$PATHApply changes:
source ~/.zshrc -
Verify Installation
java -version
javac -version
Install Java using SDKMAN (macOS / Linux)
-
Install SDKMAN
curl-s"https://get.sdkman.io" |bash -
Initialize SDKMAN
source"$HOME/.sdkman/bin/sdkman-init.sh" -
List Available Java Versions
sdk list java -
Install Java (Example: Java 21 LTS)
sdk install java21-tem -
Set Default Version
sdk default java21-tem -
Verify Installation
java -version
javac -version