How To Install Java on Ubuntu LTS (Linux) | Step-by-Step Java Setup Guide Need to set up Java on your Ubuntu LTS system? In this step-by-step tutorial, we’ll show you **how to install Java (JDK) on Ubuntu **—whether you're a developer preparing to build Java apps or simply need Java for running software. We’ll cover how to install both **OpenJDK and Oracle JDK**, and how to **set the default Java version** if multiple versions are installed. Whether you're new to Linux or a seasoned Ubuntu user, this guide will help you get Java up and running in just a few minutes. 🧰 **What You’ll Learn:** * Installing OpenJDK 21 (default in Ubuntu ) * Installing Oracle JDK manually (optional) * Verifying the Java installation * Setting JAVA\_HOME and environment variables * Switching between multiple Java versions 📦 **Commands Covered:** ```bash sudo apt update sudo apt install default-jdk java -version javac -version ``` To install a specific version like OpenJDK 17 or 21: ```bash sudo apt install openjdk-17-jdk sudo apt install openjdk-21-jdk ``` To switch between versions: ```bash sudo update-alternatives --config java sudo update-alternatives --config javac ``` Set `JAVA_HOME`: ```bash sudo nano /etc/environment # Add: JAVA_HOME="/usr/lib/jvm/java-17-openjdk-amd64" source /etc/environment echo $JAVA_HOME ``` ☕ **Why Install Java?** * Run Java-based applications like IntelliJ IDEA, Eclipse, Minecraft servers, etc. * Compile and run Java code for development or production * Build Android or enterprise applications with tools like Gradle, Maven, and Spring 📌 **Works On:** ✅ Ubuntu LTS ✅ Debian-based distros ✅ Compatible with Java apps, IDEs, and tools 💬 Drop your questions or issues in the comments—we’ll help you out! 👍 Don’t forget to **like**, **share**, and **subscribe** for more Ubuntu, Java, and Linux tutorials! \#Java #Ubuntu #Ubuntu24 #Linux #JavaOnUbuntu #JavaInstall #OpenJDK #OracleJDK #JavaDevelopment #LinuxTutorial #UbuntuTutorial #JavaLinux #JavaUbuntu24 #InstallJavaLinux #JavaSetup #JavaUbuntuLTS











