Java


Java is a class-based, object-oriented programming language that is designed to have as few implementation dependencies as possible.

LTS: 8, 11, 17, 21

For example, I install Java 21!

Table of contents

  1. macOS
    1. JDK
    2. Java Home
  2. Windows
    1. JDK
    2. Java Home

🔲 → Optional
✅ → Required
🔘 → Pick One
ℹī¸ → Information


macOS


JDK

✅ Installation

🔘 Eclipse Temurin

brew install --cask temurin21

🔘 Amazon Corretto

brew install --cask corretto21

Java Home

✅ Setting

🔘 Latest Version

echo "export JAVA_HOME=\$(/usr/libexec/java_home)" >> ~/.zshrc

🔘 Specific Version

echo "export JAVA_HOME=\$(/usr/libexec/java_home -v 17)" >> ~/.zshrc

🔲 Validation

echo $JAVA_HOME
java --version

ℹī¸ Location

🔘 Eclipse Temurin

/Library/Java/JavaVirtualMachines/temurin-XX.jdk

🔘 Amazon Corretto

/Library/Java/JavaVirtualMachines/amazon-corretto-XX.jdk

Windows


JDK

✅ Installation

🔘 Eclipse Temurin

choco install temurin21

🔘 Amazon Corretto

choco install corretto21jdk

Open Command Prompt with administrator privileges

Java Home

✅ Setting

setx /m JAVA_HOME "{LOCATION}" & refreshenv
setx /m PATH "%PATH%;%JAVA_HOME%\bin" & refreshenv

☑ Open Command Prompt with administrator privileges
☑ Replace {LOCATION} by your installation directory


🔲 Validation

echo %JAVA_HOME%
java --version

ℹī¸ Location

🔘 Eclipse Temurin

C:\Program Files\Eclipse Adoptium\jdk-XX-hotspot

🔘 Amazon Corretto

C:\Program Files\Amazon Corretto\jdkXX