Java does not update itself in every case. The Oracle Java 8 JRE has a Java Control Panel with an Update tab, but modern JDKs from Eclipse Temurin, Amazon Corretto, Microsoft, Oracle and others are updated by installing the new build or by using a package manager. The reliable method is to install the latest release of your chosen version and check it with java -version.
Pick a long term support (LTS) release for production. Current LTS lines include Java 17, Java 21 and Java 25, and each gets regular security updates from vendors.
The first line shows the version, the second shows the vendor build. Your numbers will differ. If javac is missing you have a runtime only and not a development kit.
JAVA_HOME and Path if they point to a specific folder that has changed.java -version.The older Java Control Panel route (Control Panel, Java, Update, Update Now) applies only to the legacy Oracle Java 8 JRE. For newer JDKs it does not exist.
With Homebrew:
java_home -V lists every installed JDK. To select one for the current shell:
If you installed from a .pkg installer, download and run the newer package from the vendor site. The old System Preferences Java icon only existed for the legacy Oracle JRE.
Use the package manager so updates arrive with the rest of the system.
To install a newer version side by side and switch to it on Debian or Ubuntu:
Package names depend on the distribution release, so use apt search openjdk to see what is available.
SDKMAN is a popular tool on macOS and Linux for installing several JDKs and switching between them per shell or project.
The identifier above is an example. Use the one printed by sdk list java. On Windows, winget and tools such as Scoop serve a similar purpose.
Java is open source through OpenJDK, and several vendors publish tested builds of it. They are functionally very close, and the main differences are support terms, licensing and packaging.
| Build | Typical use |
|---|---|
| Eclipse Temurin | Free, widely used general purpose builds |
| Amazon Corretto | Free builds with long support, common on AWS |
| Microsoft Build of OpenJDK | Free builds, common on Azure and Windows |
| Oracle JDK | Oracle licensed builds, check the license terms for your use |
| Distribution OpenJDK | Packages from your Linux distribution, updated by the system |
Whatever you pick, stay on one vendor per machine where you can. Mixing builds makes it harder to know which java is running and which one needs a patch.
On a server, update through the system package manager and restart the services that use Java, because a running process keeps the old runtime in memory until it restarts. In containers, change the base image tag and rebuild, for example from an older Temurin tag to the current patch release of the same major version.
Rebuilding regularly picks up the newest patch release of the 21 line. Pin the tag to a specific patch version only if you need exact reproducibility, and then bump it on a schedule.
After updating, open a new terminal and run:
On Windows PowerShell use $env:JAVA_HOME. If the old version still appears, another install is earlier on the PATH. Run which java (macOS and Linux) or where java (Windows) to find it.
Build tools have their own settings. Maven and Gradle use JAVA_HOME, and IDEs such as IntelliJ IDEA let you choose a project SDK, so update that too.
Install vendor updates as they ship. LTS releases normally receive security updates every quarter, and staying current protects you from known vulnerabilities.
Use the newest LTS release your frameworks support. For new projects that is usually Java 21 or Java 25, while older systems may stay on Java 17 until they migrate.
Usually not. Many installers keep older versions side by side, so remove versions you no longer need after confirming that nothing depends on them.
You need a Java runtime. A JDK includes the runtime plus compiler and tools, so developers normally install a JDK.
Check java -version, then update through your platform's route: winget or an installer on Windows, Homebrew or a package on macOS, and apt or dnf on Linux. Use an LTS release, keep JAVA_HOME and your IDE settings pointing at the new build, and confirm the result in a fresh terminal.