Where to get Java and what you're actually downloading
Java comes from Oracle, the company that owns it. You download it from Oracle's website at java.com or oracle.com/java/technologies/downloads. What you're getting is the Java Runtime Environment (JRE) if you only want to run Java programs, or the Java Development Kit (JDK) if you plan to write Java code.
Most people need the JRE — it's the engine that lets your computer understand and run Java programs. The JDK includes the JRE plus extra tools for programmers. Both are free. Java also comes pre-installed on some computers, so before you download anything, check whether you already have it by opening your command prompt or terminal and typing java -version. If a version number appears, you're done.
Key Takeaways
- Download Java from oracle.com/java/technologies/downloads or java.com — these are the only official sources.
- Choose the JRE (Java Runtime Environment) unless you write Java code; the JDK is for programmers.
- Select the version that matches your operating system: Windows, macOS, or Linux.
- After installation, verify it worked by typing java -version in your command prompt or terminal.
Downloading Java for Windows
Go to oracle.com/java/technologies/downloads and look for the section labeled "Java SE" (Standard Edition). Click the download button next to the latest version. A page appears asking you to accept the license agreement — check the box and click the download link for Windows. The file will be an .exe installer, usually around 100 to 200 megabytes depending on the version.
Once the file finishes downloading, double-click it to start the installer. Windows may ask for permission to make changes to your computer — click "Yes". The installer walks you through a few screens with default settings that work for most people. Click "Next" through each one, then "Install" when prompted. When it finishes, click "Close".
Downloading Java for macOS
Visit oracle.com/java/technologies/downloads and find the Java SE section. Click the download button for the latest version, then select the macOS installer. The file will be a .dmg file (disk image). Double-click it when it finishes downloading.
A window opens showing the Java installer package. Double-click the package icon to start installation. Your Mac may ask for your password because Java needs permission to install system-wide — enter it and click "Install Software". The installer finishes on its own. You can then close the window and eject the disk image by dragging it to the trash.
Downloading Java for Linux
Linux users have two routes: download a pre-built installer from Oracle, or use your Linux distribution's package manager. For the Oracle route, go to oracle.com/java/technologies/downloads, select the Linux version, and download the .tar.gz file (a compressed archive). Extract it using your file manager or by typing tar -xzf filename.tar.gz in your terminal, then follow Oracle's installation instructions for your specific Linux version.
The faster route for most Linux users is the package manager. On Ubuntu or Debian, type sudo apt install default-jre in the terminal. On Fedora or Red Hat, type sudo dnf install java-latest-openjdk. On Arch, type sudo pacman -S jre-openjdk. Each command downloads and installs Java automatically without visiting a website.
Choosing between different Java versions
Oracle releases a new Java version every six months, but only certain versions get long-term support. The most recent long-term support version is Java 21 (released in September 2023), and the previous one is Java 17 (released in September 2021). For most people, downloading the latest version is the right choice — it has the newest features and security updates.
If you're running an older program that specifically requires an older Java version, that program's documentation will tell you which version to download. You can have multiple Java versions installed at the same time, though most people only need one. If you're unsure which version a program needs, start with the latest and only switch if the program won't run.
Verifying the installation worked
After installation finishes, open your command prompt (Windows), terminal (macOS), or terminal (Linux) and type java -version, then press Enter. If Java installed correctly, you'll see output showing the version number, like "java version 21.0.1". If you see "command not found" or "java is not recognized", the installation didn't complete properly.
If the installation failed, restart your computer and try again — sometimes Java needs a restart to register with your system. If it still doesn't work, uninstall Java completely (through Control Panel on Windows, Applications folder on macOS, or your package manager on Linux) and download it again from oracle.com, making sure you're downloading the version that matches your operating system.
Uninstalling Java if you need to
On Windows, open Control Panel, click "Programs", then "Programs and Features". Find "Java" in the list, click it, and click "Uninstall". Windows asks for confirmation — click "Yes". The uninstaller removes Java from your system.
On macOS, open Finder, click "Applications", find the Java folder, and drag it to the Trash. On Linux, use your package manager: sudo apt remove default-jre on Ubuntu/Debian, sudo dnf remove java-latest-openjdk on Fedora/Red Hat, or sudo pacman -R jre-openjdk on Arch. You may want to uninstall if a program requires a specific older version, or if you're freeing up disk space.
Frequently Asked Questions
Is Java safe to download from oracle.com?
Yes — oracle.com is the official source owned by Oracle, the company that maintains Java. Never download Java from any other website. If a search result points to a different site, ignore it and go directly to oracle.com/java/technologies/downloads.
Do I need the JDK or just the JRE?
Download the JRE unless you write Java code. The JRE runs Java programs. The JDK includes the JRE plus programming tools, and it's larger and slower to install. If a program you want to run requires the JDK, its instructions will say so.
Why does Java ask for permission to install?
Java needs system-level access to run programs on your computer, so your operating system asks for permission before allowing it. This is normal and expected. Only proceed if you're installing from oracle.com.
Can I have multiple Java versions installed at once?
Yes, you can install multiple versions side by side. Your system will use the newest one by default, but older programs can request a specific version. Most people only need one version, so multiple installations aren't necessary unless a program specifically requires an older release.
What if Java won't install on my computer?
Restart your computer first — Java sometimes needs a restart to complete installation. If that doesn't work, uninstall Java completely through your system settings, restart again, then download and install it fresh from oracle.com. Make sure you're downloading the version for your operating system (Windows, macOS, or Linux).