DropVPS Team
Writer: John hens
how to install java on ubuntu 25.04

Table of Contents
What you will read?
Java is a widely used programming language and runtime environment required for many applications and enterprise tools. On Ubuntu 25.04, installing Java is straightforward using the APT package manager.
Step 1: Update Your System
Before installing, update the package lists to ensure you get the latest version of Java:
sudo apt update && sudo apt upgrade -y
Step 2: Install OpenJDK (Recommended Version)
Ubuntu repositories provide multiple versions of OpenJDK. For most modern applications, OpenJDK 17 or later is recommended:
sudo apt install openjdk-17-jdk -y
To install the latest available OpenJDK version:
sudo apt install default-jdk -y
Step 3: Verify the Installation
Once Java is installed, it’s important to confirm that the installation was successful and the system recognizes the correct version:
java -version
Step 4: Set JAVA_HOME
Some applications need the JAVA_HOME environment variable to locate Java:
sudo update-alternatives --config java
Set the environment variable in your shell profile:
nano ~/.bashrc
After completing the installation and environment setup, it is important to test Java to ensure it is functioning correctly and responding as expected. Now Java is fully installed and configured on Ubuntu 25.04, ready to run Java applications and development tools:
java -version
