How to Install Java on Ubuntu 22.04 LTS (The Best way) and Switch Between Multiple Versions Easily

Опубликовано: 05 Май 2026
на канале: Briztol Tech Academy
812
8

Java is one of the most popular programming languages. In this video, I teach you how to install Java on the latest Ubuntu version which is Ubuntu 22.04. This method is valid for all Ubuntu versions and all Java versions.

A lot of people install Java with the apt tool. However, this is not a good practice as it's not easy to uninstall Java also it can leave unnecessary files on your machine.

Also when you work in the industry, you will have to work with several Java versions on one machine. If you install Java with apt, you can't switch between multiple Java versions. Thus the method we explained in this video is the most recommended way to install Java on Ubuntu. In this video, we install Java using bashrc.

Download Java link
https://www.oracle.com/java/technologies/j...

Important Commands
lsb_release -a
sudo vim .bashrc
. ~/.bashrc
java --version