top of page

How to Install Java on Ubuntu 18.04

  • Writer: HolyHosting
    HolyHosting
  • Oct 30
  • 2 min read

How to Install Java on Ubuntu 18.04: A Complete Guide

This guide will walk you through installing Java on Ubuntu 18.04. Commands work on any private server or machine running Ubuntu 18.04 Bionic Beaver, 16.04, or other LTS versions. Java is available in three editions: Micro (ME), Enterprise (EE), and Standard (SE). This guide focuses on Java SE 11 (LTS).

ree

Java is a leading programming language, designed to minimize dependencies and follow the “write once, run anywhere” principle. Compiled Java code can run on any Java-supported platform, from simple web apps to advanced software.


JDK or JRE?

  • Oracle JRE includes the JVM and essential libraries.

  • JDK is a superset of JRE, providing additional tools like javac, jdb, and javadoc.

If you don’t compile Java software, JRE is sufficient. You can upgrade later if needed.

Use sudo if you’re not root.

Install Java Using Ubuntu Default Packages

apt-get update && apt-get upgrade
apt-get install default-jre
apt-get install default-jdk
java -version
javac -version

Expected output:

openjdk version "11.0.6" 2020-01-14
OpenJDK Runtime Environment (build 11.0.6+10-post-Ubuntu-1ubuntu118.04.1)
OpenJDK 64-Bit Server VM (build 11.0.6+10-post-Ubuntu-1ubuntu118.04.1, mixed mode, sharing)

Install Java via Oracle JDK

apt-get update && apt-get upgrade
apt-get install software-properties-common
add-apt-repository ppa:linuxuprising/java
apt-get update
apt update; apt-get install oracle-java17-installer
java -version
javac -version

Expected output:

java version "14" 2020-03-17
Java(TM) SE Runtime Environment (build 14+36-1461)
Java HotSpot(TM) 64-Bit Server VM (build 14+36-1461, mixed mode, sharing)

Manage Multiple Java Versions

update-alternatives --config java
update-alternatives --config javac
update-alternatives --config javadoc
update-alternatives --config jarsigner

Set JAVA_HOME

nano /etc/environment

Add:

JAVA_HOME="/usr/lib/jvm/java-14-oracle/bin/java"

Apply changes:

source /etc/environment
echo $JAVA_HOME

Conclusion

We hope this guide has been helpful! 🚀 Remember, don’t hesitate to ask questions on the HolyHosting Discord or contact our support team.

Follow us on Twitter @HolyHosting to stay up to date.

ree


Stuffy @ HolyHosting


 
 

Related Posts

See All
How to Fix the "Mismatched Mod Channels" Error

Hello, HolyHosting players! 🌟We know that playing on modded servers is super fun, but it can also be a headache 🧠 when your mods don’t match between your game and the server. 😩 Here’s how to fix th

 
 

CREATE YOUR SERVER

READY TO GET STARTED?

Start today and we’ll offer you a 25% discount on your first bill with our new customer promotion!

Etiqueta.png
View active promotions and coupons
holyhosting logo

Powerful servers at affordable prices.

HolyHosting

Copyright © 2025 HOLY SERVERS LLC, operating under the name HolyHosting.

REG. NO.: 001599788. This business entity is officially registered at 30 N Gould St, Suite N, Sheridan, WY 82801, Wyoming, US.

  • X
  • Instagram
  • Facebook
  • Discordia
  • YouTube
  • Tik Tok

POPULAR

US

SUPPORT

Minecraft
Minecraft Dedicated Hosting
Discord Bot Hosting
Other Games Hosting
Voice Server Hosting
MC Servers Panel
Games Servers Panel

About Us
Client Area
Branding
Payment Methods
Hardware by Location
Terms and Conditions
Privacy Policies
Refund Policies

Create a Ticket
Knowledge Base
Discord
Network Status
Request Affiliation

dmca

Copyright © 2025 HOLY SERVERS LLC, operating under the registered name HolyHosting. All rights reserved.

The payment process may be handled by Tebex Limited, acting as the registered merchant and being responsible for product fulfillment and handling billing inquiries.

bottom of page