If you're a software developer, a student learning programming, or even a system admin, you're probably gonna need this soon—or maybe you're already using it.
If you're using an older version, it's time to update.
The Java SDK, or JDK, is a set of tools that developers use to build, manage and run Java programs. It includes everything needed to create Java-based apps. JDK is constantly updated to fix issues, improve performance, and add new features. Every update makes sure your code runs better, is more secure, and is ready for new tech in the future.
By keeping your JDK updated, you're ensuring that you're using the latest enhancements. At the time of writing this blog, the latest version of Java is Java 23. Here's what you need to do to update Java JDK.
How to Find Your Default JDK Version
To check the default JDK version on your Mac, open a Terminal window and type:
javac --version
This will show you which version is being used. If it's JDK 23, it will look like this:
If you have already installed latest version then you need not to install it, however if you are running an older version, you can update Java JDK by download the latest verison and it will overwrite the older version. Here's how you can install it across different operating systems.
Overview of JDK installation
From time to time, new JDK versions are released, improving performance and security. The JDK can be installed on the following platforms:
- Microsoft Windows
- Linux
- macOS
How to Update Java SDK?
What You Need
Before you install, make sure your system meets the requirements for the JDK. You can find the full list of supported systems on Oracle's website.
What You Should Know
You can only have one version of each JDK release installed. For example, you can't install both JDK 23 and JDK 23.0.1 at the same time. If you try, the installer will replace the old version with the new one.
Installing the JDK on Windows
There are a few ways to install the JDK on Windows. Here's how:
- Go to the Java SE Development Kit download page
- Download the .exe file for Windows (make sure it's the right version).
Double-click the downloaded file to start the installation. Follow the prompts and install.
The .exe installer is the simplest for most users, while the .msi installer offers more control and is great for enterprise setups. For advanced users, command-line and silent installations provide even more flexibility, allowing for automation and no user interaction.
Once installed, you will find Java-related documentation and tools in the Start menu.
The JDK is usually installed in C:/Program Files/Java/jdk-, like jdk-23.
Installing the JDK on MacOS
You will find different versions here.
- Choose the correct JDK file for your Mac (either .dmg or .tar.gz). And click on file to start downloading.
- Open the downloaded file (either in Downloads or the file browser).
- Double-click the .dmg file to open it, then double-click the .pkg file to start the installation.
- Follow the steps in the installation wizard. You'll be asked to enter your admin password.
Once installed, you can delete the .dmg or .tar.gz file to save space.
Installing JDK on Linux
You'll need root access to install JDK on Linux.
You will find the different options to suit various types of Linux systems.
ARM64 Compressed Archive: For Linux systems that run on ARM processors (such as some Raspberry Pi models or ARM-based servers). This format is a compressed file (.tar.gz) that you can extract and install manually.
ARM64 RPM Package: Also for ARM-based Linux systems, but this version is packaged as an RPM file. RPM is a package management system used by distributions like Fedora and CentOS, so if you're using one of those, you'd choose this option for easier installation.
x64 Compressed Archive: For 64-bit Linux systems (based on Intel or AMD processors). This is another compressed file (.tar.gz) format, which is also easy to extract and install manually.
x64 Debian Package: For 64-bit Debian-based Linux distributions, such as Ubuntu. The file is packaged as a .deb file, which is the standard package format for Debian-based systems. It's easy to install using the dpkg or apt package manager.
x64 RPM Package: For 64-bit Linux systems using the RPM package format (common in Red Hat, CentOS, and Fedora). It allows for easy installation using the RPM package manager.
Download the correct JDK version for your system.
Extract the downloaded archive using this command.
tar zxvf jdk-23_linux-x64.tar.gz
Move the extracted files to your preferred directory for installation.
Note: This method does not automatically configure Java Preferences. If you need that, you'll need to configure it manually.
For RPM-based systems (such as Red Hat, CentOS, or SUSE)
Download the .rpm file. To install, run the following command:
sudo rpm -ivh jdk-23_linux-x64_bin.rpm
If you have to upgrade, then run the following command:
sudo rpm -Uvh jdk-23_linux-x64_bin.rpm
After installation, the system configures Java Preferences automatically. You can use Java commands like java, javac, etc., directly.
For Debian-based systems
Run the following command to install:
sudo dpkg -i jdk-23_linux-x64_bin.deb
Installing JDK on Oracle Linux
Oracle Linux offers two types of JDK packages:
Headless (for non-GUI Java apps), which you can install by running the following command
sudo dnf install jdk-23-headless
If you need a headful (for GUI-based Java apps), then you can run the following command.
sudo dnf install jdk-23-headful
Once installation is complete, you can verify the setup by running Java commands like java -version or javac -version to ensure everything is working properly.
Top comments (0)