Easy Steps to Install and Configure Java (Windows, Mac, Linux)
Learn how to install Java, configure environment variables, and verify setup on Windows, Mac, and Linux with this complete Java installation guide.
Java is one of the most widely used programming languages in the world. Whether you are a beginner learning programming for the first time or a professional working on enterprise-level applications, you need Java installed on your system to run, compile, and develop Java-based applications. In this detailed Java installation guide, we will cover everything you need to know about installing Java across different platforms in 2025.
From installing JDK step by step to configuring Java environment variables, this tutorial will help you set up Java smoothly on Windows, macOS, and Linux. By the end of this Java setup tutorial, you’ll be able to verify Java installation successfully and start writing Java programs on your machine.
For a practical video walkthrough, check out this tutorial: Core Java Tutorial 01 : Understanding Java, Setup & Real-World Applica...
Before moving into the installation steps, let’s understand why setting up Java is necessary.
Run Java Programs: Without Java installed, your system cannot compile or execute Java code.
Application Development: Most enterprise and web applications still rely on Java.
Tools Dependency: Popular tools like Apache Maven, Gradle, Hadoop, and Tomcat require Java.
Cross-Platform Support: Java works seamlessly on Windows, macOS, and Linux.
If you are a student, software developer, or IT professional, knowing how to set up Java on Windows, Mac, or Linux is an essential skill.
The first step in the Java setup for beginners is downloading the latest Java Development Kit (JDK). As of 2025, JDK 17 and JDK 21 (LTS versions) are widely used.
Where to Download JDK:
When downloading, make sure to select the version specific to your operating system:
Windows: download JDK for Windows
macOS: Java setup on macOS
Linux: Java installation Linux (or install Java on Ubuntu)
Now that you’ve downloaded the JDK, let’s move to installation.
A) Set Up Java on Windows
.exe file you downloaded.C:\Program Files\Java\jdk-17.After installation, proceed to configure environment variables.
B) Set Up Java on Mac
.dmg package you downloaded.java -version
C) Java Installation Linux (Ubuntu Example)
To install Java on Ubuntu, use the following commands:
sudo apt update
sudo apt install openjdk-17-jdk
For Red Hat or CentOS, use yum instead of apt.
Installing Java is only half the process. To make sure your system recognizes Java commands globally, you must configure the Java environment setup.
Windows:
Open System Properties → Advanced → Environment Variables.
Create a new variable:
Variable Name: JAVA_HOME
Variable Value: Path to JDK (e.g., C:\Program Files\Java\jdk-17)
Add %JAVA_HOME%\bin to the PATH variable.
macOS:
Edit .zshrc or .bash_profile:
export JAVA_HOME=$(/usr/libexec/java_home -v 17)
export PATH=$JAVA_HOME/bin:$PATH
Linux:
Update .bashrc or .zshrc:
export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64
export PATH=$JAVA_HOME/bin:$PATH
This ensures proper Java HOME variable setup.
Once installed, it’s important to confirm that your system recognizes Java.
Command to Verify:
java -version
Expected Output:
java version "17.0.x" 2025-XX-XX LTS
Java(TM) SE Runtime Environment
Java HotSpot(TM) 64-Bit Server VM
If you see version details, it means the Java installation 2025 is successful.
JDK (Java Development Kit): Required for compiling Java programs.
JRE (Java Runtime Environment): Required for running Java programs.
Most modern setups install both together. However, if you need just the runtime, you can install JRE separately.
Error: 'java' is not recognized → Check PATH variable.
Incorrect Java version → Update JAVA_HOME variable.
Permission errors on Linux/Mac → Use sudo when installing.
Always download from trusted sources.
Use the latest LTS version (JDK 17 or JDK 21).
Keep your JAVA_HOME variable setup consistent across tools.
Regularly update your Java installation for security.
By following this Java installation guide, you’ve learned how to:
Download Java JDK (including download JDK 17 and download JDK for Windows).
Install JDK step by step on Windows, macOS, and Linux.
Configure Java environment variables with proper Java HOME variable setup.
Verify Java installation to confirm success.
This complete Java setup tutorial ensures you can run, compile, and develop Java applications in 2025 without errors. Whether you’re a beginner or a professional, knowing how to set up Java is the first step towards mastering the world of programming.
For personalized assistance, training, or enterprise-level Java setup, get in touch with our experts. We’re here to help you every step of the way.
📞 Call us: +91-8587000904, 8587000906, 9643424141
🌐 Visit: www.cyberinfomines.com
📧 Email: vidhya.chandel@cyberinfomines.com