← Volver al blog

How to Install Java on Ubuntu

  • Xernode
  • 1 min de lectura
  • 9 de abril de 2026
VPS ubuntu vps programming java openjdk development

Introduction

Java is a widely-used programming language for building cross-platform applications. This guide shows you how to install Java (OpenJDK) on your Ubuntu VPS.

Step-by-step Guide

  1. Update your package list
    • sudo apt update
  2. Install OpenJDK (recommended version)
    • sudo apt install -y openjdk-17-jdk
  3. Verify Java installation
    • java -version
  4. (Optional) Set JAVA_HOME environment variable
    • echo 'export JAVA_HOME=$(dirname $(dirname $(readlink -f $(which java))))' >> ~/.profile
    • source ~/.profile

Recommendations

  • Use the latest LTS version of OpenJDK for stability and support.
  • Set JAVA_HOME for easier configuration with Java-based applications.
  • Regularly update Java for security patches.

Call To Action

eed a VPS for your Java applications? Check out our hosting plans: https://xernode.com/#pricing

Related Guides