Installation of Java on Windows
-
Download Java:
- Go to https://www.oracle.com/java/technologies/javase-downloads.html.
- Select Windows and click Download (typically the JDK).
-
Start Installation:
- Run the downloaded
.exefile. - Click Next and follow the instructions in the wizard.
- Run the downloaded
-
Set Environment Variable (Path):
- After installation, go to Control Panel → System and Security → System → Advanced System Setting.
- Select Environment Variables.
- Find Path under System variables.
- Add your Java’s
bindirectory (for example:C:\Program Files\Java\jdk-17\bin) toPath.
-
Verify Installation:
-
Open cmd or PowerShell.
-
Type:
java -version -
It should show the installed Java version.
-
Installation of Java on Mac
-
Download Java:
- Visit https://www.oracle.com/java/technologies/javase-downloads.html.
- Select macOS and click Download (JDK .dmg).
-
Start Installation:
- Open downloaded
.dmg. - Double-click JDK.pkg.
- Follow the instructions in the installation wizard.
- Open downloaded
-
Set Environment Variable (Path) (optional if not automatic):
-
Open
~/.zshrcor~/.bash_profile. -
Add:
export JAVA_HOME=$(/usr/libexec/java_home) export PATH=$JAVA_HOME/bin:$PATH -
Reload:
source .zshrc
-
-
Verify Installation:
java -version- Prints the installed Java version.
Installation of Java on Ubuntu
-
Open terminal.
-
Update package index first:
sudo apt update -
Installing Java (OpenJDK is recommended):
sudo apt install default-jdkor for a specific version:
sudo apt install openjdk-17-jdk -
Verify Installation:
java -version- Prints the installed Java version.
Your Feedback
Help us improve by sharing your thoughts
Online Learner helps developers master programming, database concepts, interview preparation, and real-world implementation through structured learning paths.
Quick Links
© 2023 - 2026 OnlineLearner.in | All Rights Reserved.
